What is the differences in use of these two objects?
Which one should be used for a "Youtube-like" video开发者_如何学编程 player with a custom skin and playlist?
"Component" really is the key word here, Video is the base object, the FLVPlayback Component is a UI wrapper that uses the Video object internally. It provides a simple interface for developers to add video content, with user controls, to their applications.
FLVPlayback is a component that already has the controls - scrollbar, play/pause button...etc. Video object is an object that only has the video area.
If you want to do something like the YouTube player, you will need to start with the FLVPlayback component and skin it (Example). But you will have to build a playlist by yourself or use the List/DataGrid components in flash.
FLVPlayback component is a controller for the Video class, and it implements some UI logic.
Not only does it add a skinnable UI, it also implements something called "ActionScript cue points", which you can add at run time. It's probably a very simple mechanism that peeks at the playback time at preset intervals and executes any overdue cue points in order. I implemented something similar for having external cue points for SWF files. As mentioned in the link, this method of dispatching cued events is probably less accurate than embedding cue points in the video (claiming it can be off by as much as a tenth of a second), but I think it's more flexible, and I wouldn't expect the margin of error to be any greater than the frame delay (e.g. ~16ms at 60fps) if you just implemented this simple feature yourself.
For a YouTube-like player, I'd use the Video class, because I'd have complete control over UI, which is very simple anyway (involves calling methods like play, pause, resume, seek, and listening for a few events). You wouldn't be tied into the existing skinning system, and it would also give you more control accessing frames of the NetStream for generating frame previews when seeking.
精彩评论