Package | com.myflashlab.air.extensions.player |
Class | public class VideoPlayer |
Inheritance | VideoPlayer flash.events.EventDispatcher |
Videos on Android must be copied to File.cacheDirectory
. on iOS however, video file can be
anywhere else.
Method | Defined 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 |
Constant | Defined By | ||
---|---|---|---|
EXTENSION_ID : String = com.myflashlab.air.extensions.videoPlayer [static] | VideoPlayer | ||
VERSION : String = 4.0.3 [static] | VideoPlayer |
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 .
|
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
EXTENSION_ID | Constant |
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.videoPlayer
VERSION | Constant |
public static const VERSION:String = 4.0.3
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"