The FLV Player Video Playback API allows you to control all of the major aspects of the controls of an instance of the player added to your project. This provides an even further customization aspect in terms of how the player is controlled by users.
When using the API to extend the FlvPlayer class you can either use your own custom classes, or create instances of the player using code placed directly within your Flash project.
All of the FLV Player API methods and properties support Actionscript 3.0.
playVideo() method
public function playVideo():void
Plays the current video, if it is paused.
pauseVideo() method
public function pauseVideo():void
Pauses the current video, if it is playing.
stopVideo() method
public function stopVideo():void
Stops the current video, if it is playing. Seeks the video to the beginning.
nextVideo() method
public function nextVideo():void
Progresses the video to the next available video if one is available.
previousVideo() method
public function previousVideo():void
Progresses the video to the previous available video if one is available.
videoInfo() method
public function videoInfo():void
Toggles the video info window.
videoCC() method
public function videoCC():void
Toggles the video closed captions window.
videoFullScreen() method
public function videoFullScreen():void
Toggles the player fullscreen mode.
openMenu() method
public function openMenu():void
Opens the player video menu. The menu is only available if you are using the external xml file.
closeMenu() method
public function closeMenu():void
Closes the player video menu. The menu is only available if you are using the external xml file.
videoVolume() method
public function videoVolume(vol:Number)
Sets the video volume to any Number. Available Numbers include 0-100.
videoSeek() method
public function videoSeek(seeking:Number)
Seek to any position in the video by specifying the exact time in seconds.
updateVideoSource() method
public function updateVideoSource(usersVideo:String)
Change the video source while a video is playing. This can be any string which either specifies a progressive or streaming video, or an xml resource.
The following example uses the class FlvPlayerApi to setup a new instance of the FLV Player component, and four buttons from the library that can control which video is loaded using a mouseEvent. All of the buttons and the FLV Player component are contained in the library.
package com.flvplayer
{
import com.flvplayer.FlvPlayer;
import flash.display.MovieClip;
import flash.events.*;
public class FlvPlayerApi extends MovieClip
{
public var myVideo:FlvPlayer = new FlvPlayer();
public var button1:buttonOne = new buttonOne();
public var button2:buttonTwo = new buttonTwo();
public var button3:buttonThree = new buttonThree();
public var button4:buttonFour = new buttonFour();
public function FlvPlayerApi():void
{
myVideo.vidURL = "http://your_domain.com/media_folder/your_video.mp4";
myVideo.width = 454;
myVideo.height = 255;
myVideo.x = 210;
myVideo.y = 10;
addChild(myVideo);
setupLeftInterface();
}
public function setupLeftInterface():void
{
button1.x = 20;
button1.y = 20;
button1.addEventListener(MouseEvent.MOUSE_UP, mouseDownHandler1);
addChild(button1);
button2.x = 20;
button2.y = button1.y + button1.height + 10;
button2.addEventListener(MouseEvent.MOUSE_UP, mouseDownHandler2);
addChild(button2);
button3.x = 20;
button3.y = button2.y + button2.height + 10;
button3.addEventListener(MouseEvent.MOUSE_UP, mouseDownHandler3);
addChild(button3);
button4.x = 20;
button4.y = button3.y + button3.height + 10;
button4.addEventListener(MouseEvent.MOUSE_UP, mouseDownHandler4);
addChild(button4);
}
public function mouseDownHandler1(e:MouseEvent) {
myVideo.updateVideoSource("http://your_domain.com/media_folder/your_video.mp4");
}
public function mouseDownHandler2(e:MouseEvent) {
myVideo.updateVideoSource("http://your_domain.com/media_folder/your_video.mp4");
}
public function mouseDownHandler3(e:MouseEvent) {
myVideo.updateVideoSource("http://your_domain.com/media_folder/your_video.mp4");
}
public function mouseDownHandler4(e:MouseEvent) {
myVideo.updateVideoSource("http://your_domain.com/media_folder/your_video.mp4");
}
}
}