Answered by:
[UWP]MediaPlayerElement doesn't work

Question
-
So I'm trying to use the new MediaPlayerElement, but is not working. I tried with Code:
private void DoSomehting() { MediaPlayerElement mediaPlayerElement1 = new MediaPlayerElement(); mediaPlayerElement1.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Media/Ride.mp4")); mediaPlayerElement1.AutoPlay = true; mediaPlayerElement1.AreTransportControlsEnabled = true; }
When I try with XAML code:
<MediaPlayerElement Source="ms-appx:///Media/Ride.mp4" AutoPlay="True" AreTransportControlsEnabled="True"/>
It give this error:
The TypeConverter for "IMediaPlaybackSource" does not support converting from a string.
Also tried with an video from a server on XAML and C#, same results.
I'm following the API doc: https://msdn.microsoft.com/pt-br/library/windows/apps/windows.ui.xaml.controls.mediaplayerelement.asp
- Edited by Xavier Xie-MSFT Tuesday, August 2, 2016 5:38 AM subject
Sunday, July 31, 2016 10:01 PM
Answers
-
Hi Vitor Gabriel,
After consulting with the related team, this is a known issue and the fix may be included in the future update.
For now there is no workaround in the xaml file, we could get around it by setting the Source property from code behind
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Xavier Xie-MSFT Thursday, August 11, 2016 10:05 AM
- Marked as answer by Xavier Xie-MSFT Friday, August 12, 2016 1:20 AM
Friday, August 5, 2016 5:20 AM
All replies
-
You are passing a string, the framework expects an IMediaPlaybackSource, the error is pretty obvious.
Monday, August 1, 2016 6:43 AM -
Hi Vitor Gabriel,
Welcome to the Developing Universal Windows apps forum!
Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools
I have added a general title tag for you this time, and you would need to add tag by yourself next time.
About your issue, I could reproduce it in the latest Redstone system, I would discussed this issue internally. If I got any useful information, I would update here timely.
For the moment, if you want to play video files, you could use MediaElement first.
Best Regards,
Xavier Eoro
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Edited by Xavier Xie-MSFT Tuesday, August 2, 2016 6:18 AM
Tuesday, August 2, 2016 6:17 AM -
This error should be bypass-able if you created the media playback item yourself and no relay on framework converter.Tuesday, August 2, 2016 6:57 AM
-
Hi Vitor Gabriel,
>The TypeConverter for "IMediaPlaybackSource" does not support converting from a string
This should be a document issue, I will report to related team through internal way.
As mcosmin mentioned, you can easily create a value converter by using IValueConverter interface
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Tuesday, August 2, 2016 9:44 AM -
Hi Vitor Gabriel,
After consulting with the related team, this is a known issue and the fix may be included in the future update.
For now there is no workaround in the xaml file, we could get around it by setting the Source property from code behind
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Xavier Xie-MSFT Thursday, August 11, 2016 10:05 AM
- Marked as answer by Xavier Xie-MSFT Friday, August 12, 2016 1:20 AM
Friday, August 5, 2016 5:20 AM