How to play Audio file in Android QT? - android

i developed my application in QT, i am trying to port for android. my application working fine in android with few issues. the main issue is, i am not able to play the audio file when i am trying to put the audio file play Code i am getting error
QSound::play(FilePath);
Error: : -1: error: error: cannot find -lQtMultimediaKit
D:\Projects\test\demo.cpp:996: error: undefined reference to 'QSound::play(QString const&)'
my config: QT 4.8,QT Creator 2.5.83 and necessitas and windows XP
i am able to include the QSound Header file and using intellisense to type the QSound::Play no issue while typing when i am getting error on compilation. so i tried to look into the source folder and i found QSound.h header also.
How to play the Audio file in Android using QT?

in may case it works properly with no errors
my code:
player->setMedia(QUrl("qrc:/new/prefix1/1.mp3"));
// ok it works on windows
//also works on android

Stumblend in this one while searching info, this looks useful: http://qt-project.org/doc/qt-5/qml-qtmultimedia-mediaplayer.html

While the support of Audio for Android in QT is there, it's a journey through hell with the current release. If you want it stable in the end you'll end-up searching for external libraries anyway Take a look here

this works for me
file .pro
QTPLUGIN += qtaudio_coreaudio
QT += androidextras
QT += widgets
QT += quickcontrols2
file in Resources:
player2->setMedia(QUrl("qrc:/new/prefix1/folder_x/file.mp3"));
player2->play();

Related

QT QuaZip open() fail -1000

I am trying to uncompress a Zip file. Using the latest Qt 5.15 on an Android device.
QFile downloadedZipFile(VALID_ZIP_LOCATION);
QuaZip zip(&downloadedZipFile);
if (!zip.open(QuaZip::mdUnzip)) {
qDebug() << "error" << zip.getZipError();
}
If my file is above 2GB it am getting an error -1000.
Files below 2GB are working as expected.
I tried
zip.setZip64Enabled(true);
before opening the file without success.
I also tried to use the constructor
QuaZip zip(VALID_ZIP_LOCATION)
Upon accessing the zip later I also get the following error:
QuaZip::goToFirstFile(): ZIP is not open in mdUnzip mode
which makes sense, as it couldn't open the file in the first place.
Any help is appreciated, as I am struggling with this Problem for a few days already.
The problem is an unresolved QT-Bug. Where QFile::seek cannot exceed a limit above a 32Bit Integer.
https://bugreports.qt.io/browse/QTBUG-84033
After identifying the problem I could resolve this issue by implementing native code for unzipping files in java for android.
Since iPhones are only running on 64Bit systems the native implementation did not need to be ported to ObjC.

Unable to build GStreamer pipeline; no element x265enc in Android

I am trying to implement H265 using the x265enc encoder in an android application using GStreamer. I have constructed the pipeline which works when using the terminal and gst-launch-1.0 and videotestsrc. However, when trying to execute the pipeline in android it doesn't work and gives the error gst_error_factory_make: no such element factory "x265enc"! and is unable to build the pipeline due to the element x265enc missing.
I have installed plugins-bad (contains x265enc) on the computer and it is in the android.mk file. When I look in the plugins.mk file I don't see x265 mentioned anywhere (x264 is mentioned and x264enc works). Is this an issue? Is there another way to install x265enc so that android can recognize it?
try to install gst-plugins-ugly-1.0 and it will solve your issue

Error while compiling Web RTC for Android

I am developing app of video chat in Web RTC.
I am going through documentation of Web RTC.
I have followed all steps mentioned for Getting the Code
export GYP_DEFINES="OS=android"
fetch --nohooks webrtc_android
gclient sync
I have all src code of web rtc in my root directory. As per documentation say we have to compile source to use in our application. Here i got error while compiling source using following command.
$ gn gen out/Default --args='target_os="android" target_cpu="arm"'
ERROR at //build/config/android/internal_rules.gni:636:3: Can't load input file.
import("//third_party/ijar/ijar.gni")
^-----------------------------------
Unable to load:
/Users/c86/webrtc-checkout/src/third_party/ijar/ijar.gni
I also checked in the secondary tree for:
/Users/c86/webrtc-checkout/src/build/secondary/third_party/ijar/ijar.gni
See //build/config/android/rules.gni:8:1: whence it was imported.
import("//build/config/android/internal_rules.gni")
^-------------------------------------------------
See //webrtc/examples/BUILD.gn:12:3: whence it was imported.
import("//build/config/android/rules.gni")
^----------------------------------------
See //BUILD.gn:13:5: which caused the file to be included.
"//webrtc/examples",
^------------------
How can I solve this? Am I going in right direction to develop app of video chat on Web RTC?
Building WebRTC for Android is only supported on Ubuntu(14 / 16).
Currently not supported in macOS.

Can't dump the symbols of my native library : loadDataForPdb and loadDataFromExe failed

I copied the sample of Google breakpad for Android and added it to my project. I had first a problem to get the minidumps (I was triggering SIGSEGV errors but nothing was written on my SD card). I finally managed to get some minidumps (I don't really know how but that's not my main problem).
My problem is that I can't dump the symbols of my native libraries, it says the following error message :
dump_syms.exe libcppinterface.so > libcppinterface.so.sym
loadDataForPdb and loadDataFromExe failed
Open failed
Thanks for your help
The Breakpad tools are not very cross-platform friendly. You need to build dump_syms on a Linux machine in order to get a dump_syms binary that can read ELF/DWARF and produce debug symbols from your Android binaries. The Windows dump_syms.exe is only used for dumping symbols from MSVC-produced PDB files.

Android NDK build: File not found Error

Need your guidance, I am writing one app in android with the help of native code which will communicate with CAN (Controller Area Network) port ; for that in my C code i used linux/can.h header file. and i am following "http://mobilepearls.com/labs/ndk-builder-in-eclipse/" this link to build my app. but one i set all thing i got bellow msg in eclipse console box
Compile thumb : can_port <= cansend.c
jni/cansend.c:14:23: fatal error: linux/can.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/can_port/cansend.o] Error 1
One more thing, i am working on windows environment. But i don't think this may be cause.
It is correct that it is not a Windows/Linux problem. The simple problem is that compiler is unable to find the file can.h. Now, for your info, when the compiler starts compiling, it searches for its header files in the folder
C:\(path to NDK folder)\platforms\(android-version)\(arch)\usr\include\linux
Now, if there isn't a can.h there, the compiler will flag an error. So the best way is
Either copy can.h to the above path (not tested)
Modify your Makefile to path to the correct directory where this header file is kept
Hope this helps!

Categories

Resources