' 08 July, 30 - 5:27 am
VideoViewer Class (AS3)
The VideoViewer Class is a class I created to quickly put together a video player in a matter of minutes. This is just part of a package that includes other classes such as the ProgressionBar Class which controls the scrubber and the time line. I will release the other classes at a later date.
The VideoViewer class has an easy to use API , that only consists of a couple methods and properties.
This sets up the video to be played. This method MUST be called for the class to work. Without calling this method, the video wil never get loaded into the viewer.
This toggles the pause and play states of the video. This is needed to start the video after the readyVideo() method is called. It can be place in play button functions or right after the readyVideo() method to start the video automatically.
This closes the video connection and stops the video. Once this is called, to play the video again, You need to recall the readyVideo() method.
This allows you to jump to different points in the video. This method allows one parameter. This parameter is the number (in seconds) you want the play head of the video to jump to.
Returns the NetStream Object inside the VideoViewer.
Sets the what video to play as a String //Ex: VideoViewer.file = “myVIdeo.flv”;
Also returns what video is currently set.
Sets the buffer amount in seconds.
Change the Linkage of a MovieClip to VideoViewer —– com.clementegomez.video.VideoViewer.
Be sure to make it the base class if you plan to have more than one VideoViewer in your scene.
Along with the methods and properties included with the VideoViewer API. There are also events that keep track of certain data.
This will allow you to keep track of some information dealing with the VideoViewer instance.
This keeps track of the duration of the video being played.
Here is an example of how to easily set up the VideoViewer.
import com.clementegomez.video.VideoViewer; import flash.display.Sprite; viewer.file = "myVideoflv"; viewer.readyVideo(); viewer.toggleVideo();
viewer in the above example is a VideoViewer Instance.
1) Scaling the VideoViewer will distort the video that it is playing. A workaround is to set the size of the shape inside the Movieclip or to set the height and width of the Video Viewer manually. Ex:
VideoViewer.height = 100; VideoViewer.width = 100;
This is a very useful class and I hope you put it to good use. If there are any questions at all please post them here and I will try to answer them in a timely manner.
No related posts.