Skip to main content
Home Forums Silverlight Design Video and Media How to play MediaElement from Internet
7 replies. Latest Post by tonysf on July 27, 2007.
(0)
satyenc
Member
22 points
9 Posts
06-18-2007 11:28 PM |
Hi
I want to play some video file that I have stored somewhere on Internet (Amazon S3) -
I have the following code -
public void Page_Loaded(object o, EventArgs e){ // Required to initialize variables InitializeComponent(); Uri u = new Uri("http://s3.amazonaws.com/jvaria/MITETC2006.wmv"); Movie_wmv.Source = u; Play.MouseLeftButtonDown += new MouseEventHandler(Play_MouseLeftButtonDown);}
void Play_MouseLeftButtonDown(object sender, MouseEventArgs e){ Movie_wmv.Play();}
But when I click on Play - nothing happens. if I copy the wmv file on my machine and run from there, ie, if I do something like: Movie_wmv.Source = new Uri (file:///C:/Satyen/MITETC2006.wmv); then it works
Any advise how to reference .wmv file from web
Thanks .
heuertk
Participant
1386 points
423 Posts
06-21-2007 8:06 PM |
i just tried your same code and it worked. in your xaml do you have the Page_Loaded event wired up in the root canvas? and on the media element is AutoPlay="false"?
AhmadSabry
122 points
55 Posts
06-27-2007 6:07 AM |
i have the same problem when i make the source points to a file on the pc iam using it works fine. however, if i wonna make the source points to a website it does not work. any sugestions. Thanks in advance.
_Mario
2 points
1 Posts
06-27-2007 11:22 AM |
I dont know if this is a bug, but it works - upload site to your server and run your site, good luck.
06-27-2007 1:01 PM |
Hi there
I put the whole thing (including the ClientBin folder) and it is now working - try that and do let us know
vgsbs
94 points
20 Posts
06-28-2007 4:52 AM |
Just make sure the video has been loaded before you play it. You should listen for the MediaOpened event - when the event occures the media file haders has been processed already and the file is ready to be played.
tonysf
20 points
10 Posts
07-27-2007 5:15 AM |
I've got a similar issue: when playing a video on my lcal machine, all works fine.
Playing the same video from a web site, which also host the eb page that uses the SL mediaelement, all works fine.
If I load the page hostign the SL control on my local computer, and make the mediaElement point to the video on the web server: Nothing. Not even download. I also tried using the Downloader object, and the video does not get downloaded either (I never get a download progess event back.
Any suggestion??
Thanks
Antonio
07-27-2007 5:33 AM |
To make things more complicated: if I access the web page from the internet, but I point to the file on my local hard drive,, same result: no playing.
It seems like SL only plays video coming from where the web page comes from..