Wednesday, April 18, 2007

UTF-8 encoding in Windows Media ASX files

I have worked with Windows Media streaming for some time now, and during this time one of my problems has been encoding of the text sendt to Windows Media Player. The reason why this is important for me, is that I live in Norway and have to present norwegian letters in the media player. But this method also works if you want to use other UTF-8 characters / signs as the copyright sign (©). I have now finally found the answer!

The solution is to spesify the encoding inside the generated asx file. My asx file now looks like this:

<asx version="3.0">
<param name="encoding" value="utf-8" />
<abstract>Description of the show</abstract>
<title>Title of the show</title>
<author>Author of the show</author>
<copyright>Copyright of the show</copyright>
<entry>
<starttime value="start" />
<duration value="duration" />
<ref href="rtsp link to your streaming content" />
<ref href="mms link to your streaming content" />
<ref href="http link to your streaming content" />
<abstract>Description of the broadcast</abstract>
<title>Title of the broadcast</title>
<author>Author of the broadcast</author>
<copyright>Copyright of the broadcast</copyright>
</entry>
</asx>


The asx format is well documented at msdn, but hard to find! Take a look at this link to get more information (look under the param property). It's a lot of parameters that is supported!

The reason why I have used three ref parameters is to help the player connect to the right stream. It will work for all players if you just use the mms ref, but then the server has to roll over to rtsp for all new players, and that takes a little bit of time. When I added the rtsp ref to the asx files the stream starts a little bit faster than before for Windows Media Player 9 and 10.

3 comments:

Nicholas said...

Thanks! that helped out a lot in Japanese

terren said...

You rock, thanks for posting this.

terren said...

By the way, here's an updated link for the ASX element reference.

http://msdn.microsoft.com/en-us/library/bb249663(VS.85).aspx