Skip to main content

Microsoft Silverlight

How to play MediaElement from Internet RSS Feed

(0)

satyenc
satyenc

Member

Member

22 points

9 Posts

How to play MediaElement from Internet

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
heuertk

Participant

Participant

1386 points

423 Posts

MicrosoftModerator

Re: How to play MediaElement from Internet

 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"?

-th
http://timheuer.com/blog/

-----

If this answered your question, please be sure to click the 'mark as answered' feature, otherwise please feel free to post follow-up questions that are related.

AhmadSabry
AhmadSabry

Member

Member

122 points

55 Posts

Re: Re: How to play MediaElement from Internet

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.

Best Regards,
Sabry

_Mario
_Mario

Member

Member

2 points

1 Posts

Re: How to play MediaElement from Internet

I dont know if this is a bug, but it works - upload site to your server and run your site, good luck.

satyenc
satyenc

Member

Member

22 points

9 Posts

Re: Re: Re: How to play MediaElement from Internet

Hi there

I put the whole thing (including the ClientBin folder) and it is now working - try that and do let us know

vgsbs
vgsbs

Member

Member

94 points

20 Posts

Re: How to play MediaElement from Internet

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.

--
Valentin Stoychev
Telerik, Inc

tonysf
tonysf

Member

Member

20 points

10 Posts

Re: How to play MediaElement from Internet

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

tonysf
tonysf

Member

Member

20 points

10 Posts

Re: Re: How to play MediaElement from Internet

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..

 

Antonio

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities