| Package | com.soma.view.video |
| Class | public class SomaVideo |
| Inheritance | SomaVideo flash.display.Sprite |
Author: Romuald Quantin - www.soundstep.com
Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0
Copyright:
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.
The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.
Usage:
SomaVideo is created to display a simple video without any controller or skins (play, volume, etc), you can access to the most basic actions on a video such as play, pause, stop, volume and so on.
var video:SomaVideo = new SomaVideo("video/video.flv");
video.addEventListener(SomaVideoEvent.METADATA_UPDATE, metadataHandler);
video.addEventListener(SomaVideoEvent.PLAYHEAD_UPDATE, playheadHandler);
addChild(video);
private function metadataHandler(e:SomaVideoEvent):void {
trace(e.player.duration);
}
private function playheadHandler(e:SomaVideoEvent):void {
trace(e.player.time);
}
See also
| Property | Defined by | ||
|---|---|---|---|
| bufferLength : Number [read-only] Get the length in seconds of the buffer, the "buffer length" will reach the "buffer time" before playing the video, you can get the information on a SomaVideoEvent.BUFFERING_START, SomaVideoEvent.BUFFERING_PROGRESS and SomaVideoEvent.BUFFERING_COMPLETE event.
| SomaVideo | ||
| bufferPercentage : Number [read-only] Get the percentage of the buffer (seconds loaded), the "buffer length" will reach the "buffer time" before playing the video, you can get the information on a SomaVideoEvent.BUFFERING_START, SomaVideoEvent.BUFFERING_PROGRESS and SomaVideoEvent.BUFFERING_COMPLETE event.
| SomaVideo | ||
| bufferTime : Number Buffer value in seconds, the default (flash built-in default of the NetStream class) is 0.1 (tenth of a second).
| SomaVideo | ||
| bytesLoaded : Number [read-only] Get the bytes loaded of the video (preloading), you can get the information on a SomaVideoEvent.PRELOADING_START, SomaVideoEvent.PRELOADING_PROGRESS and SomaVideoEvent.PRELOADING_COMPLETE event.
| SomaVideo | ||
| bytesTotal : Number [read-only] Get the bytes total that the video will preload, you can get the information on a SomaVideoEvent.PRELOADING_START, SomaVideoEvent.PRELOADING_PROGRESS and SomaVideoEvent.PRELOADING_COMPLETE event.
| SomaVideo | ||
| creator : String [read-only] Get the creator, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| duration : Number [read-only] Get the time length (seconds) of the video, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| enableAutoResizeOnMetaData : Boolean Whether or not the Video instance (not the SomaVideo intance) will be resized when the metadata are received, default is true.
Note: enabled or disabled will not change anything if you specified a size to the SomaVideo instance. | SomaVideo | ||
| haskeyframes : Boolean [read-only] Whether or not the video has keyframes, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| hasmetadata : Boolean [read-only] Whether or not the video has metadata, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| heightVideoSource : Number [read-only] Get the original height of the video, only available after that an event SomaVideoEvent.XMPDATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| isPlaying : Boolean [read-only] Whether or not the video is currently playing.
| SomaVideo | ||
| keyframes : Object [read-only] Get the video keyframes, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| lastkeyframelocation : String [read-only] Get the last key frame location, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| lastkeyframetimestamp : Number [read-only] Get the last keyframe timestamp, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| LOG_ERRORS : Boolean = true [static] Indicates that the NetStatusEvent errors will be traced in the console (default true).
| SomaVideo | ||
| loop : Boolean Specifies whether the video will replay on its own when it reaches the end.
| SomaVideo | ||
| metadatacreator : String [read-only] Get the metadata creator, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| metaDataObject : Object [read-only] Get the metadata object received, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| netConnection : NetConnection [read-only] Get the NetConnection instance of the video.
| SomaVideo | ||
| pan : Number Pan (panning) of the video, the range is -1 (for left) to 1 (for right) and the default is 0.
| SomaVideo | ||
| preloadingPercentage : Number [read-only] Get the percentage of the video that is preloaded (0 to 100), you can get the information on a SomaVideoEvent.PRELOADING_START, SomaVideoEvent.PRELOADING_PROGRESS and SomaVideoEvent.PRELOADING_COMPLETE event.
| SomaVideo | ||
| smoothing : Boolean Specifies whether the video should be smoothed (interpolated) when it is scaled.
| SomaVideo | ||
| sound : SoundTransform SoundTransform instance used for the volume and panning
| SomaVideo | ||
| stream : NetStream [read-only] Get the NetStream instance of the video.
| SomaVideo | ||
| time : Number [read-only] Get the current position of the playhead.
| SomaVideo | ||
| url : String [read-only] Get the url of the video.
| SomaVideo | ||
| video : Video [read-only] Get the Video instance used to display the video.
| SomaVideo | ||
| videodatarate : Number [read-only] Get the video data rate (kbps), only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| volume : Number Volume of the video, the range is 0 to 1 and the default is 1.
| SomaVideo | ||
| widthVideoSource : Number [read-only] Get the original width of the video, only available after that an event SomaVideoEvent.XMPDATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| xmpDataObject : Object [read-only] Get the XMP data object received, only available after that an event SomaVideoEvent.XMPDATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
| SomaVideo | ||
| Method | Defined by | ||
|---|---|---|---|
|
SomaVideo(url:String)
Creates a SomaVideo Instance.
| SomaVideo | ||
|
dispose():void
Call this method when you dispose a SomaVideoPlayer to remove children, event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
| SomaVideo | ||
|
info():String
Get information about the video.
| SomaVideo | ||
|
pause():void
Pause the video.
| SomaVideo | ||
|
play():void
Play the video.
| SomaVideo | ||
|
resume():void
Resume the video.
| SomaVideo | ||
|
seek(offset:Number):void
Move the video playhead to a (approximate) time.
| SomaVideo | ||
|
setSource(url:String):void
Set the source to play.
| SomaVideo | ||
|
stop():void
Stop the video.
| SomaVideo | ||
| bufferLength | property |
bufferLength:Number [read-only]Get the length in seconds of the buffer, the "buffer length" will reach the "buffer time" before playing the video, you can get the information on a SomaVideoEvent.BUFFERING_START, SomaVideoEvent.BUFFERING_PROGRESS and SomaVideoEvent.BUFFERING_COMPLETE event.
Implementation public function get bufferLength():Number
| bufferPercentage | property |
bufferPercentage:Number [read-only]Get the percentage of the buffer (seconds loaded), the "buffer length" will reach the "buffer time" before playing the video, you can get the information on a SomaVideoEvent.BUFFERING_START, SomaVideoEvent.BUFFERING_PROGRESS and SomaVideoEvent.BUFFERING_COMPLETE event.
Implementation public function get bufferPercentage():Number
| bufferTime | property |
bufferTime:Number [read-write]Buffer value in seconds, the default (flash built-in default of the NetStream class) is 0.1 (tenth of a second).
Implementation public function get bufferTime():Number
public function set bufferTime(value:Number):void
| bytesLoaded | property |
bytesLoaded:Number [read-only]Get the bytes loaded of the video (preloading), you can get the information on a SomaVideoEvent.PRELOADING_START, SomaVideoEvent.PRELOADING_PROGRESS and SomaVideoEvent.PRELOADING_COMPLETE event.
Implementation public function get bytesLoaded():Number
| bytesTotal | property |
bytesTotal:Number [read-only]Get the bytes total that the video will preload, you can get the information on a SomaVideoEvent.PRELOADING_START, SomaVideoEvent.PRELOADING_PROGRESS and SomaVideoEvent.PRELOADING_COMPLETE event.
Implementation public function get bytesTotal():Number
| creator | property |
creator:String [read-only]Get the creator, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get creator():String
| duration | property |
duration:Number [read-only]Get the time length (seconds) of the video, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get duration():Number
| enableAutoResizeOnMetaData | property |
enableAutoResizeOnMetaData:Boolean [read-write] Whether or not the Video instance (not the SomaVideo intance) will be resized when the metadata are received, default is true.
Note: enabled or disabled will not change anything if you specified a size to the SomaVideo instance.
public function get enableAutoResizeOnMetaData():Boolean
public function set enableAutoResizeOnMetaData(value:Boolean):void
| haskeyframes | property |
haskeyframes:Boolean [read-only]Whether or not the video has keyframes, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get haskeyframes():Boolean
| hasmetadata | property |
hasmetadata:Boolean [read-only]Whether or not the video has metadata, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get hasmetadata():Boolean
| heightVideoSource | property |
heightVideoSource:Number [read-only]Get the original height of the video, only available after that an event SomaVideoEvent.XMPDATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get heightVideoSource():Number
| isPlaying | property |
isPlaying:Boolean [read-only]Whether or not the video is currently playing.
Implementation public function get isPlaying():Boolean
| keyframes | property |
keyframes:Object [read-only]Get the video keyframes, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get keyframes():Object
| lastkeyframelocation | property |
lastkeyframelocation:String [read-only]Get the last key frame location, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get lastkeyframelocation():String
| lastkeyframetimestamp | property |
lastkeyframetimestamp:Number [read-only]Get the last keyframe timestamp, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get lastkeyframetimestamp():Number
| LOG_ERRORS | property |
public static var LOG_ERRORS:Boolean = trueIndicates that the NetStatusEvent errors will be traced in the console (default true).
| loop | property |
loop:Boolean [read-write]Specifies whether the video will replay on its own when it reaches the end.
Implementation public function get loop():Boolean
public function set loop(value:Boolean):void
| metadatacreator | property |
metadatacreator:String [read-only]Get the metadata creator, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get metadatacreator():String
| metaDataObject | property |
metaDataObject:Object [read-only]Get the metadata object received, only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get metaDataObject():Object
| netConnection | property |
netConnection:NetConnection [read-only]Get the NetConnection instance of the video.
Implementation public function get netConnection():NetConnection
| pan | property |
pan:Number [read-write]Pan (panning) of the video, the range is -1 (for left) to 1 (for right) and the default is 0.
Implementation public function get pan():Number
public function set pan(value:Number):void
| preloadingPercentage | property |
preloadingPercentage:Number [read-only]Get the percentage of the video that is preloaded (0 to 100), you can get the information on a SomaVideoEvent.PRELOADING_START, SomaVideoEvent.PRELOADING_PROGRESS and SomaVideoEvent.PRELOADING_COMPLETE event.
Implementation public function get preloadingPercentage():Number
| smoothing | property |
smoothing:Boolean [read-write]Specifies whether the video should be smoothed (interpolated) when it is scaled.
Implementation public function get smoothing():Boolean
public function set smoothing(value:Boolean):void
| sound | property |
sound:SoundTransform [read-write]SoundTransform instance used for the volume and panning
Implementation public function get sound():SoundTransform
public function set sound(value:SoundTransform):void
| stream | property |
stream:NetStream [read-only]Get the NetStream instance of the video.
Implementation public function get stream():NetStream
| time | property |
time:Number [read-only]Get the current position of the playhead.
Implementation public function get time():Number
| url | property |
url:String [read-only]Get the url of the video.
Implementation public function get url():String
| video | property |
video:Video [read-only]Get the Video instance used to display the video.
Implementation public function get video():Video
| videodatarate | property |
videodatarate:Number [read-only]Get the video data rate (kbps), only available after that an event SomaVideoEvent.METADATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get videodatarate():Number
| volume | property |
volume:Number [read-write]Volume of the video, the range is 0 to 1 and the default is 1.
Implementation public function get volume():Number
public function set volume(value:Number):void
| widthVideoSource | property |
widthVideoSource:Number [read-only]Get the original width of the video, only available after that an event SomaVideoEvent.XMPDATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get widthVideoSource():Number
| xmpDataObject | property |
xmpDataObject:Object [read-only]Get the XMP data object received, only available after that an event SomaVideoEvent.XMPDATA_UPDATE (or SomaVideoEvent.ORIGINAL_SIZE_UPDATED) has been dispatched.
Implementation public function get xmpDataObject():Object
| SomaVideo | () | constructor |
public function SomaVideo(url:String)Creates a SomaVideo Instance.
Parametersurl:String — A String (URL) of the video to play.
|
| dispose | () | method |
public function dispose():voidCall this method when you dispose a SomaVideoPlayer to remove children, event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
| info | () | method |
public function info():StringGet information about the video.
ReturnsString — A String.
|
| pause | () | method |
public function pause():voidPause the video.
| play | () | method |
public function play():voidPlay the video.
| resume | () | method |
public function resume():voidResume the video.
| seek | () | method |
public function seek(offset:Number):voidMove the video playhead to a (approximate) time.
Parametersoffset:Number — The approximate time value, in seconds, to move to in a video file.
|
| setSource | () | method |
public function setSource(url:String):voidSet the source to play.
var video:SomaVideo = new SomaVideo("video.flv");
video.setSource("othervideo.flv");
url:String — A String (URL).
|
| stop | () | method |
public function stop():voidStop the video.