Akash
Akash

Reputation: 5012

Embedded Windows media player continues to buffer

I am trying to use WMP to stream .mp3 files. I have a mp3 file sized around 4mb.

Code used:

<OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701"
STANDBY="Loading Microsoft Windows Media Player components..." TYPE="application/x-oleobject"
width="300" height="70">
    <param name="fileName" value="'+song_urlIE+'">
    <param name="animationatStart" value="true">
    <param name="transparentatStart" value="true">
    <PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
    <PARAM NAME="AutoStart" VALUE="True">
    <PARAM name="uiMode" value="none">
    <PARAM name="PlayCount" value="9999">
    <param name="autoStart" value="true">
    <param name="showControls" value="true">
    <param name="Volume" value="-300">
    <param name="ShowStatusBar" value="true">
    <param name="BufferingTime" VALUE="1">
    <embed type="application/x-mplayer2" id="players" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
    BufferingTime=1 src="'+song_url+'" name="MediaPlayer1" width=300 height=70
    showstatusbar=-1 autostart=1 showcontrols=1 volume=-300>

The problem is that the song continues to buffer until it is fully downloaded and then only plays.

Can this be solved?

Upvotes: 0

Views: 1033

Answers (1)

selbie
selbie

Reputation: 104524

IIRC, from my experience with WMP, if the Content-Type header isn't correct, WMP won't stream (play as it downloads), and will behave as you observe.

Either that, or the actual URL should end in ".mp3" as a hint of the file type.

Or both.

What Content-Type does the server code return for the content? Is it "audio/mpeg" or something else? If you don't know, use a network sniffer to discover. I'm not sure if WMP uses the browser's download agent, so you might be able to use the F12 tools to observe the URL. Otherwise, go download NetMon or Wireshark.

Upvotes: 2

Related Questions