Packagecom.myflashlab.air.extensions.player
Classpublic class VideoPlayer
InheritanceVideoPlayer Inheritance flash.events.EventDispatcher

VideoPlayer extension will let you easily play video clips in your Air applications no matter if your project is a standard flash/Air app or on Starling. you will be able to play video files (device os must support the video format of course) using the default device player.

Videos on Android must be copied to File.cacheDirectory. on iOS however, video file can be anywhere else.

View the examples



Public Methods
 MethodDefined By
  
VideoPlayer($useAirPrefixForAndroid:Boolean = true)
To initialize the extension
VideoPlayer
  
play($address:String, $type:String):void
to start playing a video using available video players.
VideoPlayer
  
remove():void
to dispose the extension
VideoPlayer
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.videoPlayer
[static]
VideoPlayer
  VERSION : String = 4.0.3
[static]
VideoPlayer
Constructor Detail
VideoPlayer()Constructor
public function VideoPlayer($useAirPrefixForAndroid:Boolean = true)

To initialize the extension

Parameters
$useAirPrefixForAndroid:Boolean (default = true) — If you are using AIR CLI to compile your app to manually remove the initial air. prefix from your app package name, you must set this parameter to false . Otherwise, it must be true.
Method Detail
play()method
public function play($address:String, $type:String):void

to start playing a video using available video players. on Android, user can have the option to chose which installed player he wants to use for playing the video but in iOS the default player will be launched.

On Android, the video file must be copied to File.cacheDirectory. but on iOS you can play the local video from anywhere and you are not limited to File.cacheDirectory

Parameters

$address:String — local nativePath to the video or online https://site.com/video.mp4
 
$type:String — VideoType.ONLINE or VideoType.LOCAL

remove()method 
public function remove():void

to dispose the extension

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.videoPlayer

VERSIONConstant 
public static const VERSION:String = 4.0.3

Examples
use the extension like this:
     import com.myflashlab.air.extensions.player.
          var _ex:VideoPlayer = new VideoPlayer();
     
     // play from File.cacheDirectory
     var vid:File = File.cacheDirectory.resolvePath("exVideoPlayer.mp4");
     _ex.play(vid.nativePath, VideoType.LOCAL);
     
     // or play online
     _ex.play("https://myflashlabs.com/showcase/Bully_Scholarship_Edition_Trailer.mp4", VideoType.ONLINE);
     
     // you can also play youtube videos using "com.doitflash.remote.youtube.YouTubeLinkParser"