[Development] QtMultimedia on Android

Łukasz Korbel lkorbel at milosolutions.com
Mon Jun 10 19:37:42 CEST 2013


I want to report problem with usage of QML MediaPlayer/VideoOutput on
Android.
We used very simple qml file for test (working good on linux) with sample
video that plays correctly on android native player.

We don't put this message on interest list because we believe there are
some problems within implementation. Similar testing application was
working with build from 5.1 alpha release time (unfortunately not the one
tagged as "alpha" now and we could've not find working commit again).

We're using build from stable branch from 27-05-2013. Libs and application
were build for Android SDK API level 14. When running application on
Android devices proper windows shows up, we can hear audio of playback but
no video at all (black screen all the time, like frames were not drawn to
surface texture). Same effect observed with QtMultimedia libs built from
wip/android branch.
I've attached project source. I've also attached output from logcat
(android.log). Two most suspicious lines from logs are:

W/System.err( 7783): java.lang.InstantiationException: can't instantiate
class org.qtproject.qt5.android.multimedia.QtAndroidMediaPlayer; no empty
constructor

and...

E/BufferQueue( 7783): [unnamed-7783-0] dequeueBuffer: SurfaceTexture has
been abandoned!
E/SoftwareRenderer(   87): Surface::dequeueBuffer returned error -19

First we thought that this is because QtAndroidMediaPlayer starts before
SurfaceHolder is set but looks like the problem lies somewhere else. Is
there something wrong in implementation indeed or is just we doing
something wrong here?

Thanks in advance for help,

*Łukasz Korbel*
Senior Software Developer

Milo Solutions
(+48) 517539562

http://milosolutions.com


P.S.
For quick review key parts of source.

main.qml
----------------------------------------------------------------------------------------------------------------------
import QtQuick 2.0
import QtMultimedia 5.0

Rectangle {
    id: player
    width: 1024
    height: 720

    MediaPlayer {
        id: mediaplayer
        autoLoad: true
        autoPlay: true
        volume: 1.0
        source: "file:///mnt/sdcard/Download/test.mp4"
    }

    VideoOutput {
        id: videoOutput
        width: parent.width
        height: parent.height
        anchors.centerIn: parent
        fillMode: VideoOutput.PreserveAspectFit
        source: mediaplayer
    }
}
----------------------------------------------------------------------------------------------------------------------

AndroidManifest.xml
----------------------------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<manifest android:versionCode="1"
package="org.qtproject.example.mediaplayer_test" xmlns:android="
http://schemas.android.com/apk/res/android"
android:sharedUserId="com.milosolutions.qt" android:versionName="1.0">
    <application
android:name="org.qtproject.qt5.android.bindings.QtApplication"
android:label="@string/app_name">
        <activity
android:name="org.qtproject.qt5.android.bindings.QtActivity"
android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden"
android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <meta-data android:name="android.app.qt_sources_resource_id"
android:resource="@array/qt_sources"/>
            <meta-data android:name="android.app.repository"
android:value="@string/repository"/>
            <meta-data android:name="android.app.qt_libs_resource_id"
android:resource="@array/qt_libs"/>
            <meta-data android:name="android.app.bundled_libs_resource_id"
android:resource="@array/bundled_libs"/>
            <meta-data android:name="android.app.lib_name"
android:value="mediaplayer-test"/>

            <!-- Run with local libs -->
            <meta-data android:name="android.app.use_local_qt_libs"
android:value="1"/>
            <meta-data android:name="android.app.libs_prefix"
android:value="/data/data/com.milosolutions.qt/app_data/"/>
            <meta-data android:name="android.app.load_local_libs"
android:value="plugins/mediaservice/libandroidmediaplayer.so:lib/libQt5MultimediaQuick_p.so:lib/libQt5QuickParticles.so:plugins/platforms/android/libqtforandroidGL.so:"/>
            <meta-data android:name="android.app.load_local_jars"
android:value="jar/QtAndroid.jar:jar/QtMultimedia.jar:"/>
            <meta-data android:name="android.app.static_init_classes"
android:value="org.qtproject.qt5.android.multimedia.QtAndroidMediaPlayer:"/>
            <!--  Messages maps -->
            <meta-data android:name="android.app.ministro_not_found_msg"
android:value="@string/ministro_not_found_msg"/>
            <meta-data android:name="android.app.ministro_needed_msg"
android:value="@string/ministro_needed_msg"/>
            <meta-data android:name="android.app.fatal_error_msg"
android:value="@string/fatal_error_msg"/>
            <!--  Messages maps -->
            <!-- Splash screen -->
            <meta-data android:name="android.app.splash_screen"
android:resource="@layout/splash"/>
            <!-- Splash screen -->
        </activity>
    </application>
    <supports-screens android:largeScreens="true"
android:normalScreens="true" android:anyDensity="true"
android:smallScreens="true"/>
    <uses-feature android:glEsVersion="0x00020000"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
----------------------------------------------------------------------------------------------------------------------

libs.xml
----------------------------------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<resources>
    <array name="qt_sources">
        <item>https://download.qt-project.org/ministro/android/qt5/latest
</item>
    </array>
    <string name="repository">default</string>
    <array name="bundled_libs"/>
    <array name="bundled_in_lib"/>
    <array name="bundled_in_assets"/>
    <array name="qt_libs">
        <item>gnustl_shared</item>
        <item>Qt5Core</item>
        <item>Qt5Gui</item>
        <item>Qt5Network</item>
        <item>Qt5V8</item>
        <item>Qt5Qml</item>
        <item>Qt5Quick</item>
        <item>Qt5Multimedia</item>
    </array>
</resources>
----------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130610/adf9e854/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: android.log
Type: application/octet-stream
Size: 13663 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130610/adf9e854/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source.tar.bz2
Type: application/x-bzip2
Size: 21748 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130610/adf9e854/attachment.bin>


More information about the Development mailing list