MediaPlay的PlayStateChange事件

Value State Description
0 Undefined Windows Media Player is in an undefined state.
1 Stopped Playback of the current media item is stopped.
2 Paused Playback of the current media item is paused. When a media item is paused, resuming playback begins from the same location.
3 Playing The current media item is playing.
4 ScanForward The current media item is fast forwarding.
5 ScanReverse The current media item is fast rewinding.
6 Buffering The current media item is getting additional data from the server.
7 Waiting Connection is established, but the server is not sending data. Waiting for session to begin.
8 MediaEnded Media item has completed playback.
9 Transitioning Preparing new media item.
10 Ready Ready to begin playing.
11 Reconnecting Reconnecting to stream.

用下面方法检测状态(只适用于IE浏览器):
<SCRIPT LANGUAGE="JScript" EVENT="playStateChange(NewState)" FOR="mmsplayer">  
switch (NewState)
{
case 1:
         .......相关状态控制语句       
         break;
      .
      .
      .
      .
      .
      .   
}
</script>

 

 

 

 

 

exescope打开wmp.dll,在TYPELIB里有WMP的所有方法和属性,内容那叫一个多啊。通过网上其他文章,再结合TYPELIB,记录下一些比较重要的东西。

其中与流播放有直接关系的事件有:OpenStateChange,PlayStateChange,Buffering,MarkerHit,ScriptCommand等。这里也只说一下PlayStateChange,其他方法只要参考TYPELIB就非常清楚了。

    用Javascript处理PlayStateChange事件的方法为:

<SCRIPT FOR="MediaPlayer" EVENT="PlayStateChange(NewState)"
LANGUAGE
="JScript">
switch (NewState)
{
case num:
      
//代码          
}
</SCRIPT>

其中的MediaPlayer为网页中WMP的id,num为播放状态代码,具体为:
wmppsUndefined = 0;//未知状态
wmppsStopped = 1;//播放停止
wmppsPaused = 2;//播放暂停
wmppsPlaying = 3;//正在播放
wmppsScanForward = 4;//向前搜索
wmppsScanReverse = 5;//向后搜索
wmppsBuffering = 6;//正在缓冲
wmppsWaiting = 7;//正在等待流开始
wmppsMediaEnded = 8;//播放流已结束
wmppsTransitioning = 9;//准备新的媒体文件
wmppsReady = 10;//播放准备就绪
wmppsReconnecting = 11;//尝试重新连接流媒体数据
wmppsLast = 12;//上一次状态,状态没有改变

你可能感兴趣的:(change)