开发者

Detect if a Flash video is playing or not

开发者 https://www.devze.com 2023-02-06 05:15 出处:网络
I have开发者_高级运维 a NetConnection attached to a NetStream, which is in turn attached to a Video. As you can guess, this is a video player. I\'ve looked through the public properties of all three c

I have开发者_高级运维 a NetConnection attached to a NetStream, which is in turn attached to a Video. As you can guess, this is a video player. I've looked through the public properties of all three classes and could not find an "isPlaying" property - a boolean that would tell me video is currently running (and not paused, stopped, nor corrupted). Does such a property exist? I've tried the following but they don't work:

  • return this.video.currentFPS > 0. The FPS is around 25 even when the video is paused.
  • Listen on NetStatusEvent change and update my own private isPlaying property accordingly. The NetStatus does not change when you pause the video.


You can see the docs for the Video and NetStream elements, which you'll note neither have an isPlaying property.

You can check out the VideoPlayer class's code (probably at C:\Program Files\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\FLVPlayback\fl\video if you left the default install and use windows) to see an example of how to manage the play states, just don't copy the code as it's a scrambled mess.

tl;dr: you have to manage the video's state yourself


use a Timer to check your stream.time and compare it to the previous value. writing a custom togglePause() function and storing the state in some private variable'd also be useful

0

精彩评论

暂无评论...
验证码 换一张
取 消