10-11-2012 07:08 PM
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,
Solved! Go to Solution.
10-11-2012 07:55 PM
10-11-2012 09:24 PM
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 ![]()
02-22-2013 04:38 PM
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.