This is a migrated thread and some comments may be shown as answers.

how to Play video files in sliverlight

1 Answer 49 Views
Upload
This is a migrated thread and some comments may be shown as answers.
sachin
Top achievements
Rank 1
sachin asked on 31 Aug 2011, 04:54 PM
Hi,

i want to play video file in media element with set source runtime from web server path.
i am using following code :

  String strVideoName="PoreotixAmericasBest.mp4";
  Uri VideoUri = new Uri(App.Current.Host.Source, strVideoName );
  myVideo.Source = VideoUri;
  myVideo.Play();

i am using above code, but it's not working video not play.
If i set file name which is in "Client Bin" directory at design time then it's play.

anybody have a solution for set video file path dynamically at runtime replay me as soon as possible.


1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 05 Sep 2011, 01:19 PM
Hello Sachin,

Basically the RadMediItem in its core is a wrapper around the MediaElement control and as such has no access to the local file system. So in order to be able to play video files with Silverlight, you'll need to make them visible to the world (through http or Media Services...) and after that play them in the RadMediaPlayer as RadMediaItems with source like "http://mydomain.com/Videos/Video.wmv".

Or you will have to place them in the folder containing your .xap, so that they can be requested under the same path (Source="/Video.wmv" - this relative path indicates the folder where the SL xap is located, in this case the ClientBin and this is why placing the movie in the ClientBin works). When you set the MediaItem Source to new Uri(App.Current.Host.Source, strVideoName ) - the item will look for the video file in the ClientBin as the App.Current.Host.Source holds the path to the Silverlight application XAP file and this is why your scenario only works when you place the video in the ClientBin directory..

I hope this information will help you.

Greetings,
Tina Stancheva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Upload
Asked by
sachin
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or