I've stored a video to a BitmapImage and want the user to be able to replay it. However, when I run my program it treats my BitmapImage like it's empty when it's not. I've tried doing the same thing with a picture saved to a BitmapImage and any picture will appear and fill the screen like I tell it to, but videos just don't show up. Why is this?
Asked
Active
Viewed 58 times
2 Answers
1
You cant store a video in a bitmapimage. Videos should be stored in StorageFile.

Chirag Shah
- 981
- 1
- 6
- 12
-
Okay, so how would I get my video out of a StorageFile? – TS- Apr 19 '16 at 19:03
-
Or rather how can I put a Binding on a StorageFile. I can get the StorageFile without any problems but I don't know how to use it with a Binding. – TS- Apr 19 '16 at 22:30
-
Use mediaelement, set the source of the control using the setsource method and play the media element using play method. refer this: http://stackoverflow.com/questions/13181809/winrt-c-sharp-play-a-viddler-video-using-mediaelement – Chirag Shah Apr 20 '16 at 05:44
-
you can try this: http://weblogs.asp.net/jdanforth/binding-mediaelement-to-a-viewmodel-in-a-windows-8-store-app but its not recommended to have binding for mediaelement's source property. – Chirag Shah Apr 20 '16 at 06:02
-
SetSource was in fact the thing I needed. Thanks! – TS- Apr 21 '16 at 11:55
0
Use in your dictionary:
<MediaElement x:Key="Video1" Source="ms-appx:///Assets/Videos/Video.mp4"/
and then on page:
<MediaElement Source="{StaticResource Video1}"/>
remember to start width AutoPlay="True".

Elektryczny
- 56
- 4