Silverlight MediaElement to play video
-
Hi, I am new to Silverlight application.I want to display video using Mediaelement tag and I used the below code to play video.
And I placed that video file in Xaml folder but when i run the application i am not getting any results to play video. The steps I followed are correct or anything missed. Please help me how to play video using silverlight mediaelement and mention the steps to play video and where i have to place video to use it in mediaelement source property. Thanks in advance Pavani
-
Hi, I am new to Silverlight application.I want to display video using Mediaelement tag and I used the below code to play video.
And I placed that video file in Xaml folder but when i run the application i am not getting any results to play video. The steps I followed are correct or anything missed. Please help me how to play video using silverlight mediaelement and mention the steps to play video and where i have to place video to use it in mediaelement source property. Thanks in advance Pavani
AVI files aren't currently supported for MediaElement AFAIK. Try converting the AVI to WMV :) Also, if you're going to use a relative URI like that, make sure the media file is in the same folder as the contents of the Silverlight app's XAP. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
AVI files aren't currently supported for MediaElement AFAIK. Try converting the AVI to WMV :) Also, if you're going to use a relative URI like that, make sure the media file is in the same folder as the contents of the Silverlight app's XAP. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
thanks for your reply. I tried with all files but if i give weblink like "http://silverlight.services.live.com/82169/Blend1/video.wmv" in source property its working. And if I use local file either it is avi or wmv file its not working. Can you please tell me where to place my video and how to call that video in source property.
-
thanks for your reply. I tried with all files but if i give weblink like "http://silverlight.services.live.com/82169/Blend1/video.wmv" in source property its working. And if I use local file either it is avi or wmv file its not working. Can you please tell me where to place my video and how to call that video in source property.
You need to use a proper URI for the MediaElement Source. If you use
Source="a_video.wmv"
then that's a relative URI so a_video.wmv needs to be in your Silverlight app's XAP. You could add the file to your project and set its Build Action to "Content" and set Copy to Output Directory to copy the file. For local files you need an absolute URL, something like
Source="File://c:/somefolder/a_video.wmv"
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
You need to use a proper URI for the MediaElement Source. If you use
Source="a_video.wmv"
then that's a relative URI so a_video.wmv needs to be in your Silverlight app's XAP. You could add the file to your project and set its Build Action to "Content" and set Copy to Output Directory to copy the file. For local files you need an absolute URL, something like
Source="File://c:/somefolder/a_video.wmv"
Mark Salsbery Microsoft MVP - Visual C++ :java:
thank you its working now I added reference to my video in app's XAP folder. I used the Relative URI source='/a_video.wmv' I have one doubt here I created silvetlight project now i want to create webapplication and i want to use silverlight media elements etc and for web application where i have to place my video to play. please help me if you know and how to host silverlight projects?
-
thank you its working now I added reference to my video in app's XAP folder. I used the Relative URI source='/a_video.wmv' I have one doubt here I created silvetlight project now i want to create webapplication and i want to use silverlight media elements etc and for web application where i have to place my video to play. please help me if you know and how to host silverlight projects?
pavanip wrote:
where i have to place my video to play
Depends on your requirements. You can place the files anywhere they are accessible by URI, or bundled with the application. You may not want to deliver large media in your app because the user would have to wait for it to download before the app even runs. You could, however, make a separate xap to hold media resources.
Mark Salsbery Microsoft MVP - Visual C++ :java: