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
精彩评论