I require to include a video file for playback in xap file, instead of separately uploading it in Isolated Storage.
What are my options?
Originally I had wanted to play a video file from the MediaLibrary. Video playback of a file stored in Media Library
As I learnt, it is not possible to do so. Hence, I am exploring the option of at least including the video file inside xap file.
Kindly note that the API for video playback supports reading video files only from Isolated storage, hence I can't just include it in the project and expect it to work.
Assuming your video is located inside assets folder (in your .xap file) the following should work:
private void PlayVideo()
{
var mediaPlayerLauncher = new MediaPlayerLauncher
{
Media = new Uri("Assets/video.mp4", UriKind.Relative),
Location = MediaLocationType.Install,
Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop,
Orientation = MediaPlayerOrientation.Landscape
};
mediaPlayerLauncher.Show();
}
Add it as a resource as you add images to your project. Solution explorer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.