Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Problems loading server-side http stream in MediaElement RSS

23 replies

Last post Feb 24, 2011 01:21 PM by agasociados

(0)
  • jonesm

    jonesm

    0 Points

    11 Posts

    Problems loading server-side http stream in MediaElement

    Jul 23, 2008 03:02 PM | LINK

    Hey,

     

    I have a problem playing a server-side stream in a MediaElement. I use the Silverlight 2 Beta 2 framework.

     

    My Silverlight code is as follows:

    <UserControl x:Class="MySilverlightSite.Controls.MusicPlayer"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Width="500" Height="30" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">

    <Grid>

    <MediaElement IsMuted="False" x:Name="_MePlayMusic" Margin="0,0,0,0" Source="http://MYIPADDRESS:PORTNUMBER/" />

    </Grid>

    </UserControl>

     

    I get the following error message when trying to run the code: 4001 AG_E_NETWORK_ERROR. When I take the address to the stream (here in the code: http://MYIPADDRESS:PORTNUMBER/) I would like to play and open it in Windows Media Player it opens perfectly so the address should be correct.

     

    I have tried to search this forum and google the error and couldn't find any solution to it. Hope any one on this forum have a solution to my problem.

     

    Thanks in advance.

    Jonas Midstrup
    TENTEO IT-Consultants
    http://www.tenteo.com/
    http://silverlight.tenteo.com/
  • Yi-Lun Luo - MSFT

    Yi-Lun Luo -...

    All-Star

    25149 Points

    2759 Posts

    Microsoft

    Re: Problems loading server-side http stream in MediaElement

    Jul 25, 2008 08:43 AM | LINK

    Hello, have you encoded the file with Expression Encoder? Also make sure you're running your Silverlight application from the http protocol, not the local file system.

    shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.
  • jonesm

    jonesm

    0 Points

    11 Posts

    Re: Problems loading server-side http stream in MediaElement

    Jul 25, 2008 09:39 AM | LINK

    Yi-Lun Luo - MSFT

    Hello, have you encoded the file with Expression Encoder? Also make sure you're running your Silverlight application from the http protocol, not the local file system.

     

    Hey Yi-Lun,

    Thanks for your reply.

    It's not a file, but a live server-side http stream from a ShoutCast radio station so no I have not encoded it in Expression Encoder. I run the Silverlight application locally when developing it. Is that causing a problem?

    Jonas Midstrup
    TENTEO IT-Consultants
    http://www.tenteo.com/
    http://silverlight.tenteo.com/
  • Yi-Lun Luo - MSFT

    Yi-Lun Luo -...

    All-Star

    25149 Points

    2759 Posts

    Microsoft

    Re: Re: Problems loading server-side http stream in MediaElement

    Jul 25, 2008 10:06 AM | LINK

    Make sure the stream returns VC-1 encoded contents (wmv). That's the only format supported by Silverlight.

    shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.
  • jonesm

    jonesm

    0 Points

    11 Posts

    Re: Re: Problems loading server-side http stream in MediaElement

    Jul 25, 2008 10:29 AM | LINK

    Yi-Lun Luo - MSFT

    Make sure the stream returns VC-1 encoded contents (wmv). That's the only format supported by Silverlight.

     

    But it's not a video stream. It's an audio stream sent in Mp3-encoding. Why are you talking video?

    Jonas Midstrup
    TENTEO IT-Consultants
    http://www.tenteo.com/
    http://silverlight.tenteo.com/
  • Yi-Lun Luo - MSFT

    Yi-Lun Luo -...

    All-Star

    25149 Points

    2759 Posts

    Microsoft

    Re: Re: Re: Problems loading server-side http stream in MediaElement

    Jul 25, 2008 10:43 AM | LINK

    Not all mp3 is supported. Please refer to http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx.

    shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.
  • jonesm

    jonesm

    0 Points

    11 Posts

    Re: Re: Re: Problems loading server-side http stream in MediaElement

    Jul 25, 2008 10:52 AM | LINK

    Yi-Lun Luo - MSFT

    Not all mp3 is supported. Please refer to http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx.

    I have studied that page several times and the Mp3-stream should be supported. The stream is encoded as: MPEG Audio Layer-3 160Kbps Stereo. So that should not be a problem...

    Jonas Midstrup
    TENTEO IT-Consultants
    http://www.tenteo.com/
    http://silverlight.tenteo.com/
  • spender

    spender

    Member

    14 Points

    7 Posts

    Re: Problems loading server-side http stream in MediaElement

    Jul 28, 2008 12:32 AM | LINK

     I've successfully loaded Shoutcast streams with SL2...

    You can read about it here... feel free to ask any questions in the comments

    Things to remember:

    Replace http:// with mms:// for the url of the stream

    If the stream is the root of the server, follow it with a semi colon

    so, http://shoutcastserver.net:8000/ would become mms://shoutcastserver.net:8000/;

    Also, unless published online or on a local webserver, this will not work.

  • jonesm

    jonesm

    0 Points

    11 Posts

    Re: Problems loading server-side http stream in MediaElement

    Jul 28, 2008 12:32 PM | LINK

    spender

     I've successfully loaded Shoutcast streams with SL2...

    You can read about it here... feel free to ask any questions in the comments

    Things to remember:

    Replace http:// with mms:// for the url of the stream

    If the stream is the root of the server, follow it with a semi colon

    so, http://shoutcastserver.net:8000/ would become mms://shoutcastserver.net:8000/;

    Also, unless published online or on a local webserver, this will not work.

     

    Thanks spender for your post. I've read 2 of your blogs with streaming and it was very interesting.

    I've tried the "tricks" you wrote and now I don't get any errors when playing the stream but I don't get any sound either [:(]

    What can I do about that?

    I run the xaml from my local machine. Will it work if I run it on a webserver?

    Jonas Midstrup
    TENTEO IT-Consultants
    http://www.tenteo.com/
    http://silverlight.tenteo.com/
  • spender

    spender

    Member

    14 Points

    7 Posts

    Re: Problems loading server-side http stream in MediaElement

    Jul 28, 2008 12:36 PM | LINK

     From my own experience, yes, it will run if you put the content on a webserver. When running in the local security zone, something goes wrong. If it is anything like Flash (I'm a bit of a Silverlight noob), mixing local and online file access is not allowed.