Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Developer
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
Accepted Solution

multimedia player issue

Hi, i'm trying to get a MediaPlayer to work playing a video but i'm hitting some path issues (maybe???):

 

To get started, i simply modified the sample 'filepicker' app to get the path of the video file. Once i have the path, i set it to the sourceUrl of the MediaPlayer and call the play() function but i get the following error:

 

Oct 11 18:42:37.830 com.example.bb10samples.pickers.filepicker.testDev__filepicker2.35016910.0 qt-msg 0 START 1 MediaPlayerPrivate::
lastError 
Oct 11 18:42:37.830 com.example.bb10samples.pickers.filepicker.testDev__filepicker2.35016910.0 qt-msg 0 => END 1 ( 0 ms): 
Oct 11 18:42:37.830 com.example.bb10samples.pickers.filepicker.testDev__filepicker2.35016910.0 qt-msg 0 MediaPlayer::prepare: Error 
attaching input source. url=QUrl("file:///accounts/1000/shared/camera/VID_00000001.mp4") , error= SourceUnavailable 
Oct 11 18:42:37.830 com.example.bb10samples.pickers.filepicker.testDev__filepicker2.35016910.0 qt-msg 0 => END 1 ( 13 ms): 
Oct 11 18:42:37.830 com.example.bb10samples.pickers.filepicker.testDev__filepicker2.35016910.0 qt-msg 0 MediaPlayer::play: Unable to
prepare the player
Oct 11 18:42:37.830 com.example.bb10samples.pickers.filepicker.testDev__filepicker2.35016910.0 qt-msg 0 => END 1 ( 13 ms):

 

Here's my MediaPlayer config:

MediaPlayer {
            id: myPlayer
            // The file to play.
            sourceUrl: "/path/to/media.mp4"       
      
            // Use the device's primary display to
            // show the video.
            videoOutput: VideoOutput.PrimaryDisplay
             
            // The ID of the ForeignWindow control to
            // use as the rendering surface.
            windowId: videoControl.windowId              
        }

 Here's the code to ForeignWindowControl:

ForeignWindowControl {
            id: videoControl
            windowId: "myVideoSurface"
            updatedProperties: 
                WindowProperty.Size | WindowProperty.Position | WindowProperty.Visible
            visible: boundToWindow
            preferredWidth: 1280
            preferredHeight: 768
        }

 And the added Button to play the selected video file:

// The 'Play Video' button
            Button {
                horizontalAlignment: HorizontalAlignment.Center
                topMargin: 100

                text: qsTr ("Play Video")
                onClicked: {
                    myPlayer.sourceUrl = picker.selectedFile;
                    myPlayer.play()
                }
            }

 

 

Anyone got an idea as to what is the issue?

 

Thanks,

 

 

 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: multimedia player issue

Are you specifying the "access_shared" permission in your bar-descriptor.xml file? Without that, your app cannot read from, write to, or otherwise access files in the shared/ folders.

See https://developer.blackberry.com/cascades/documentation/device_platform/filesystem/ and https://developer.blackberry.com/native/beta/documentation/com.qnx.doc.native_sdk.devguide/com.qnx.d...

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Developer
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha

Re: multimedia player issue

Thanks Peter, that fixed it.  I was pretty sure the docs said that by default we have read access to those shared folders....guess i must have misread or this changed at some point :smileysad:

 

 

Developer
Posts: 652
Registered: ‎02-03-2010
My Device: Z10 LE

Re: multimedia player issue

Lew, I am tring the same thing and it is working except I don't see the first frame of the video before I hit Play.  Is that as expected or is there something I should do?  Thanks.


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing