MediaPlayer & VideoOutput combo on Android - any working example?



  • I try to use MediaPlayer and VideoOutpu for displaying video content but no success... :-(

    According to "some book example":http://qmlbook.org/ch10/index.html# it is as simple as stone axe but for some weird reasons it does not work for me. Neither on desktop - W7, 64 bits - nor Android device. I tried it with remote video file and local, too...

    What file formats are supported by MediaPlayer?

    There are some log examples below.

    (1) local Mp4 file, Android device:
    @D/dalvikvm( 653): GC_CONCURRENT freed 1627K, 18% free 8452K/10183K, paused 18ms+157ms, total 451ms
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:47 (onStatusChanged): qml: MediaPlayer - onStatusChanged: 3
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:47 (onStatusChanged): qml: MediaPlayer - onStatusChanged: 6
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:36 (onPlaying): qml: onPlaying
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:37 (onPlaying): qml: MediaPlayer - content source: qrc:/Vserv/qml/stock-footage-sailing-in-the-wind-through-the-waves-hd-sailing-boat-shot-in-full-hd-at-the-sailing-in-the.mp4
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:38 (onPlaying): qml: MediaPlayer - availability: 0
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:39 (onPlaying): qml: MediaPlayer - status: 6
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:40 (onPlaying): qml: MediaPlayer - hasAudio: true
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:41 (onPlaying): qml: MediaPlayer - hasVideo: true
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:42 (onPlaying): qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x2a20f930)
    E/MediaPlayer( 653): error (1, -2147483648)
    E/MediaPlayer( 653): Error (1,-2147483648)
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:47 (onStatusChanged): qml: MediaPlayer - onStatusChanged: 0
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:29 (onError): qml: onError (code, msg): 5 Error: (Unknown error/Insufficient resources)
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:30 (onError): qml: MediaPlayer - content source: qrc:/Vserv/qml/stock-footage-sailing-in-the-wind-through-the-waves-hd-sailing-boat-shot-in-full-hd-at-the-sailing-in-the.mp4
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:31 (onError): qml: MediaPlayer - availability: 0
    E/Qt ( 653): qrc:/Vserv/qml/VservVideoContent.qml:32 (onError): qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x2a20f930)@

    (2) Local OGG file, W7 machine
    @qml: MediaPlayer - onStatusChanged: 2
    qml: bufferProgress: 0
    qrc:/Vserv/qml/QmlXmlHttpRequest.qml:34: Error: Invalid state
    qml: Video received...
    qml: MediaPlayer - onStatusChanged: 3
    qml: bufferProgress: 0
    qml: MediaPlayer - onStatusChanged: 6
    qml: bufferProgress: 0
    qml: onPlaying
    qml: bufferProgress: 0
    qml: MediaPlayer - content source: qrc:/Vserv/qml/Big_Buck_Bunny_Trailer_400p.ogg
    qml: MediaPlayer - availability: 0
    qml: MediaPlayer - status: 6
    qml: MediaPlayer - playbackState: 1
    qml: MediaPlayer - hasAudio: true
    qml: MediaPlayer - hasVideo: false
    qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x43bc6f8)@

    (3) Remote OGG file, W7 machine
    @qml: MediaPlayer - onStatusChanged: 2
    qml: bufferProgress: 0
    qrc:/Vserv/qml/QmlXmlHttpRequest.qml:34: Error: Invalid state
    qml: Video received...
    qml: onError (code, msg): 2
    qml: MediaPlayer - content source: http://upload.wikimedia.org/wikipedia/commons/7/75/Big_Buck_Bunny_Trailer_400p.ogg
    qml: MediaPlayer - availability: 0
    qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x46d3528)
    qml: onErrorChanged (code, msg): 2
    qml: MediaPlayer - content source: http://upload.wikimedia.org/wikipedia/commons/7/75/Big_Buck_Bunny_Trailer_400p.ogg
    qml: MediaPlayer - availability: 0
    qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x46d3528)
    qml: MediaPlayer - onStatusChanged: 8
    qml: bufferProgress: 0
    qml: MediaPlayer - onStatusChanged: 2
    qml: bufferProgress: 0
    qml: onPlaying
    qml: bufferProgress: 0
    qml: MediaPlayer - content source: http://upload.wikimedia.org/wikipedia/commons/7/75/Big_Buck_Bunny_Trailer_400p.ogg
    qml: MediaPlayer - availability: 0
    qml: MediaPlayer - status: 2
    qml: MediaPlayer - playbackState: 1
    qml: MediaPlayer - hasAudio: false
    qml: MediaPlayer - hasVideo: false
    qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x46d3528)
    qml: onError (code, msg): 2
    qml: MediaPlayer - content source: http://upload.wikimedia.org/wikipedia/commons/7/75/Big_Buck_Bunny_Trailer_400p.ogg
    qml: MediaPlayer - availability: 0
    qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x46d3528)
    qml: onErrorChanged (code, msg): 2
    qml: MediaPlayer - content source: http://upload.wikimedia.org/wikipedia/commons/7/75/Big_Buck_Bunny_Trailer_400p.ogg
    qml: MediaPlayer - availability: 0
    qml: MediaPlayer - metadata: QDeclarativeMediaMetaData(0x46d3528)
    qml: MediaPlayer - onStatusChanged: 8
    qml: bufferProgress: 0@



  • I don't know about remote file.
    But I was able to show a local MP4 video on Android without any problem using VideoOutput, and from what I know you should set a full local URL path and you cannot embed video into Qt resources (qrc://)

    So, instead of an URL like:
    qrc:/Vserv/qml/stock-footage-sailing-in-the-wind-through-the-waves-hd-sailing-boat-shot-in-full-hd-at-the-sailing-in-the.mp4
    you should pass an URL like:
    file://mnt/sdcard/Videos/stock-footage-sailing-in-the-wind-through-the-waves-hd-sailing-boat-shot-in-full-hd-at-the-sailing-in-the.mp4


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.