KoolMoves AS3 API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class MediaPlayer

Package | km.components
Class | public class MediaPlayer
Inheritance | MediaPlayer UIComponent flash.display.Sprite

The MediaPlayer component class.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | analyzer : SpectrumAnalyzer [read-only] >> Reference to the spectrum analyzer. | MediaPlayer
|  | audioOnlyAnalyzer : Boolean = false When set to true, the spectrum analyzer is only shown when no image or video is displayed. | MediaPlayer
|  | btnDrag : BaseButton [read-only] >> Reference to the drag button. | MediaPlayer
|  | btnFullScreen : BaseButton [read-only] >> Reference to the full screen button. | MediaPlayer
|  | btnMute : BaseButton [read-only] >> Reference to the mute button. | MediaPlayer
|  | btnNext : BaseButton [read-only] >> Reference to the next button. | MediaPlayer
|  | btnPause : BaseButton [read-only] >> Reference to the pause button. | MediaPlayer
|  | btnPlay : BaseButton [read-only] >> Reference to the play button. | MediaPlayer
|  | btnPlaylist : BaseButton [read-only] >> Reference to the playlist button. | MediaPlayer
|  | btnPrev : BaseButton [read-only] >> Reference to the previous button. | MediaPlayer
|  | btnStop : BaseButton [read-only] >> Reference to the stop button. | MediaPlayer
|  | bufferIconColor : uint [write-only] Sets the ARGB color value of the icon shown when the media player is buffering media content. | MediaPlayer
|  | currentTime : int [read-only] Returns the current time of the media file currently being played. | MediaPlayer
|  | duotone : Array The duotone property can be used to convert the colors of the component into duotone. | UIComponent
|  | enabled : Boolean Specifies if the component is enabled. If a component is disabled, it will be turned into grayscale and become partly transparent. | UIComponent
|  | isBuffering : Boolean [read-only] Returns a boolean value indicating if the media player is currently buffering media content. | MediaPlayer
|  | knVolume : Knob [read-only] >> Reference to the volume knob. | MediaPlayer
|  | mediaInfo : Object Object containing additional media info if encountered inside the media file. | MediaPlayer
|  | overlay : Image [read-only] >> Reference to the overlay image. | MediaPlayer
|  | playlist : List >> Reference to the playlist. | MediaPlayer
|  | playlistOptions : Object [read-only] >> Reference to the playlist options object. | MediaPlayer
|  | prLoad : MediaPlayerSlider [read-only] >> Reference to the load progress indicator. | MediaPlayer
|  | slTimeline : MediaPlayerSlider [read-only] >> Reference to the timeline slider. | MediaPlayer
|  | slVolume : MediaPlayerSlider [read-only] >> Reference to the volume slider. | MediaPlayer
|  | soundTransform : SoundTransform A SoundTransform object can be assigned to the soundTransform property to set volume and balance. | MediaPlayer
|  | textFormat : TextFormat TextFormat to be used for text overlays. | MediaPlayer
|  | timer : TextField [read-only] >> Reference to the timer textfield. | MediaPlayer
|  | timerFormat : String = "C" String indicating the timer format. C is replaced with the current time, T is replaced with the total time and R is replaced with the remaining time. When timerFormat is set to 'C / T' for example, both the current time and the total time are displayed in the timer textfield. | MediaPlayer
|  | toolTip : String Text to use as toolTip when ToolTip is enabled. | UIComponent
|  | totalTime : int [read-only] Returns the total time of the media file currently being played. | MediaPlayer
|  | underlay : Image [read-only] >> Reference to the underlay image. | MediaPlayer
|  | videoBufferTime : Number = 1 Buffer time for video content. | MediaPlayer
|  | x : Number | UIComponent
|  | y : Number | UIComponent

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | MediaPlayer() | MediaPlayer
|  | loadSelectedItem():void Loads the currently selected playlist item. | MediaPlayer
|  | move(x:int, y:int, animationMode:int = 0, animationFrames:int = 12, easeInOut:Boolean = false):void Moves the component to the specified coordinates. | UIComponent
|  | next(e:Event = null):void Action performed when the next button is pressed. | MediaPlayer
|  | pause(e:Event = null):void Action performed when the pause button is pressed. | MediaPlayer
|  | play(e:Event = null):void Action performed when the play button is pressed. | MediaPlayer
|  | prev(e:Event = null):void Action performed when the previous button is pressed. | MediaPlayer
|  | seek(offset:Number):void Seeks a point in time expressed in msec within the media file currently being played. | MediaPlayer
|  | setDisplay(x:int, y:int, width:int, height:int, color:uint = 0, ellipse:Boolean = false):void Sets the properties of the media player display. Most properties speak for themselves. | MediaPlayer
|  | setExternalXMLPlaylist(request:URLRequest):void Sets an external XML based playlist. | MediaPlayer
|  | setProperties(o:Object):void Sets a number of properties at once. | UIComponent
|  | setXMLPlaylist(XMLPlaylist:*):void Sets an XML based playlist. | MediaPlayer
|  | stop(e:Event = null):void Action performed when the stop button is pressed. | MediaPlayer

Events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined by
--- | --- | --- | ---
|  | animationComplete | The animationComplete event is broadcasted when an animated move is completed. | UIComponent
|  | cuePoint | The cuePoint event is broadcasted when cuePoints are encountered inside a media file. | MediaPlayer
|  | displayOut | The displayOut event is broadcasted when the mouse is moved out of the display object. | MediaPlayer
|  | displayOver | The displayOver event is broadcasted when the mouse is moved over the display object. | MediaPlayer
|  | itemComplete | The itemComplete event is broadcasted when the end of a media file has been reached. | MediaPlayer
|  | itemLoad | The itemLoad event is broadcasted when the load of a playlist item has been initiated. | MediaPlayer
|  | mediaInfo | The mediaInfo event is broadcasted when additional information is encountered inside a media file. | MediaPlayer
|  | playlistComplete | The playlistComplete event is broadcasted when the end of the playlist has been reached and loop has been set to false. | MediaPlayer
|  | playlistSet | The playlistSet event is broadcasted when a new playlist has been set. | MediaPlayer

Property detail

analyzer | property

`analyzer:SpectrumAnalyzer` [read-only]

>> Reference to the spectrum analyzer.

Implementation
`public function get analyzer():SpectrumAnalyzer`

audioOnlyAnalyzer | property |

`public var audioOnlyAnalyzer:Boolean = false`

When set to true, the spectrum analyzer is only shown when no image or video is displayed.

btnDrag | property |

`btnDrag:BaseButton` [read-only]

>> Reference to the drag button.

Implementation
`public function get btnDrag():BaseButton`

btnFullScreen | property |

`btnFullScreen:BaseButton` [read-only]

>> Reference to the full screen button.

Implementation
`public function get btnFullScreen():BaseButton`

btnMute | property |

`btnMute:BaseButton` [read-only]

>> Reference to the mute button.

Implementation
`public function get btnMute():BaseButton`

btnNext | property |

`btnNext:BaseButton` [read-only]

>> Reference to the next button.

Implementation
`public function get btnNext():BaseButton`

btnPause | property |

`btnPause:BaseButton` [read-only]

>> Reference to the pause button.

Implementation
`public function get btnPause():BaseButton`

btnPlay | property |

`btnPlay:BaseButton` [read-only]

>> Reference to the play button.

Implementation
`public function get btnPlay():BaseButton`

btnPlaylist | property |

`btnPlaylist:BaseButton` [read-only]

>> Reference to the playlist button.

Implementation
`public function get btnPlaylist():BaseButton`

btnPrev | property |

`btnPrev:BaseButton` [read-only]

>> Reference to the previous button.

Implementation
`public function get btnPrev():BaseButton`

btnStop | property |

`btnStop:BaseButton` [read-only]

>> Reference to the stop button.

Implementation
`public function get btnStop():BaseButton`

bufferIconColor | property |

`bufferIconColor:uint` [write-only]

Sets the ARGB color value of the icon shown when the media player is buffering media content.

Implementation
`public function set bufferIconColor(value:uint):void`

currentTime | property |

`currentTime:int` [read-only]

Returns the current time of the media file currently being played.

Implementation
`public function get currentTime():int`

isBuffering | property |

`isBuffering:Boolean` [read-only]

Returns a boolean value indicating if the media player is currently buffering media content.

Implementation
`public function get isBuffering():Boolean`

knVolume | property |

`knVolume:Knob` [read-only]

>> Reference to the volume knob.

Implementation
`public function get knVolume():Knob`

mediaInfo | property |

`public var mediaInfo:Object`

Object containing additional media info if encountered inside the media file.

overlay | property |

`overlay:Image` [read-only]

>> Reference to the overlay image.

Implementation
`public function get overlay():Image`

playlist | property |

`playlist:List` [read-write]

>> Reference to the playlist.

Implementation
`public function get playlist():List`
`public function set playlist(value:List):void`

playlistOptions | property |

`playlistOptions:Object` [read-only]

>> Reference to the playlist options object.

Implementation
`public function get playlistOptions():Object`

prLoad | property |

`prLoad:MediaPlayerSlider` [read-only]

>> Reference to the load progress indicator.

Implementation
`public function get prLoad():MediaPlayerSlider`

slTimeline | property |

`slTimeline:MediaPlayerSlider` [read-only]

>> Reference to the timeline slider.

Implementation
`public function get slTimeline():MediaPlayerSlider`

slVolume | property |

`slVolume:MediaPlayerSlider` [read-only]

>> Reference to the volume slider.

Implementation
`public function get slVolume():MediaPlayerSlider`

soundTransform | property |

`soundTransform:SoundTransform` [read-write]

A SoundTransform object can be assigned to the soundTransform property to set volume and balance.

Implementation
`public function get soundTransform():SoundTransform`
`public function set soundTransform(value:SoundTransform):void`

textFormat | property |

`textFormat:TextFormat` [read-write]

TextFormat to be used for text overlays.

Implementation
`public function get textFormat():TextFormat`
`public function set textFormat(value:TextFormat):void`

timer | property |

`timer:TextField` [read-only]

>> Reference to the timer textfield.

Implementation
`public function get timer():TextField`

timerFormat | property |

`public var timerFormat:String = "C"`

String indicating the timer format.
C is replaced with the current time, T is replaced with the total time and R is replaced with the remaining time.
When timerFormat is set to 'C / T' for example, both the current time and the total time are displayed in the timer textfield.

totalTime | property |

`totalTime:int` [read-only]

Returns the total time of the media file currently being played.

Implementation
`public function get totalTime():int`

underlay | property |

`underlay:Image` [read-only]

>> Reference to the underlay image.

Implementation
`public function get underlay():Image`

videoBufferTime | property |

`public var videoBufferTime:Number = 1`

Buffer time for video content.

Constructor detail

MediaPlayer | () | constructor

`public function MediaPlayer()`
Method detail

loadSelectedItem | () | method

`public function loadSelectedItem():void`

Loads the currently selected playlist item.

next | () | method |

`public function next(e:Event = null):void`

Action performed when the next button is pressed.

Parameters

| `e:Event` (default = `null`)``

pause | () | method |

`public function pause(e:Event = null):void`

Action performed when the pause button is pressed.

Parameters

| `e:Event` (default = `null`)``

play | () | method |

`public function play(e:Event = null):void`

Action performed when the play button is pressed.

Parameters

| `e:Event` (default = `null`)``

prev | () | method |

`public function prev(e:Event = null):void`

Action performed when the previous button is pressed.

Parameters

| `e:Event` (default = `null`)``

seek | () | method |

`public function seek(offset:Number):void`

Seeks a point in time expressed in msec within the media file currently being played.

Parameters

| `offset:Number`

setDisplay | () | method |

`public function setDisplay(x:int, y:int, width:int, height:int, color:uint = 0, ellipse:Boolean = false):void`

Sets the properties of the media player display.
Most properties speak for themselves. Ellipse is a boolean value indicating of the display should be masked elliptically.

Parameters

| `x:int`
| `y:int`
| `width:int`
| `height:int`
| `color:uint` (default = `0`)``
| `ellipse:Boolean` (default = `false`)``

setExternalXMLPlaylist | () | method |

`public function setExternalXMLPlaylist(request:URLRequest):void`

Sets an external XML based playlist.

Parameters

| `request:URLRequest`

Example
Example of a playlist file

    <!-- start is the zero based index of the playlist where it should start the first time. -->
    <!-- pause can be "init", "before", "after" or "false". When omitted pause is "false". -->
    <!-- repeat can be "true" or "false" and controls if the playlist continues at the beginning when the end is reached. -->
    <!-- shuffle can be "true" or "false" and controls if the playlist items are shuffled. -->

    <playlist start="0" pause="false" repeat="false" shuffle="false">

     <item label="First playlist item (video)">

      <!-- scalemode can be "0" (scale to fit), "1" (scale and crop) or "2" (crop). -->

      <video src="video1.flv" scalemode="1" />

      <!-- transition can be "0" (fade in/out), "1" (from/to top), "2" (from/to right), "3" (from/to bottom) or "4" (from/to left). -->
      <!-- timeframe consists of four values; in transition starts, in transition ends, out transition starts, out transition ends. -->

      <overlays transition="1" timeframe="2,3,6,8">

       <!-- cradius controls the radius of the corners of the overlay. -->

       <overlay x="0" y="0" width="200" height="24" text="item 1, text 1" link="http://www.koolmoves.com/" cradius="6" line="0x000000" fill="0xffffff" />
       <overlay x="0" y="50" width="200" height="24" text="item 1, text 2" />
      </overlays>
     </item>

     <item label="Second playlist item (still image; asset)">

      <!-- asset is the name of the image asset in case you are using embedded images or images preloaded with the AssetManager. -->
      <!-- ttime is the time the transition takes, itime the time the image is fully visible so the sum of those will be the total time. -->
      <!-- effects can be "2" (sepia), "4" (b/w), "8" (channel build), "16" (ease out), "32" (bounce) or a combination like "34" (sepia + bounce). -->

      <still asset="asset1" bgcolor="0x201000" scalemode="0" tid="0x00000003" ttime="2" itime="8" effects="32" />
     </item>

     <item label="Third playlist item (still + audio; timing from still)" timing="still">
      <still src="image1.jpg" scalemode="0" tid="0x83f7c040" ttime="3" itime="7" />
      <audio src="audio1.mp3" />
     </item>

     <item label="Fourth playlist item (still + audio; timing from audio)">
      <still src="image2.jpg" scalemode="0" tid="0xfbeffcc0" ttime="3" />
      <audio src="audio2.mp3" />
     </item>

     <item label="Fifth playlist item (audio only)">
      <audio src="audio3.mp3" />
     </item>

     <item label="Sixth playlist item (FMS video stream)">
      <video connect="rtmp://url.com/directory" src="mp4:vid" />
     </item>

     <item label="[ Images ]">
      <playlist src="sublist1.xml" />
     </item>

    </playlist>

tid (transition id) table

    0x00000000  no effect
    0x2b805cc0  bars, horizontal
    0x2b805ec0  bars, vertical
    0x4301dec0  blinds, large, diagonal, left-down
    0x4301ddc0  blinds, large, diagonal, left-up
    0x4301dcc0  blinds, large, diagonal, right-down
    0x4301dfc0  blinds, large, diagonal, right-up
    0x23801cc0  blinds, large, horizontal
    0x23801fc0  blinds, large, vertical
    0x2b804cc0  blinds, small, horizontal
    0x2b804fc0  blinds, small, vertical
    0x0113fdc0  checkerboard, in
    0x0113fcc0  checkerboard, out
    0x0013fc20  circle in [block style]
    0x0013fd20  circle out [block style]
    0x0013fcc0  circles, in
    0x0013fdc0  circles, out
    0x0013fdc4  circles, rotating in
    0x4113fd40  claws, closing
    0x4113fc40  claws, opening
    0x00000009  cover down
    0x00000006  cover left
    0x0000000b  cover left-down
    0x0000000c  cover left-up
    0x00000007  cover right
    0x0000000a  cover right-down
    0x0000000d  cover right-up
    0x00000008  cover up
    0x8113fc40  curves down
    0x8113fe80  curves left
    0x8113ff80  curves right
    0x8113fd40  curves up
    0x4113fd20  diamond in [block style]
    0x4113fc20  diamond out [block style]
    0x4113fdc0  diamonds out
    0x4113fd80  diamonds, narrow, in
    0x4113fc80  diamonds, narrow, out
    0xfbeffc00  dissolve [block style]
    0xfbdffcc0  dissolve, little waves
    0xfbeffcc0  dissolve, pixel
    0x00000010  fade smoothly
    0x00000014  fade, cover clockwise
    0x00000015  fade, cover counter clockwise
    0x00000019  fade, cover down
    0x00000016  fade, cover left
    0x0000001b  fade, cover left-down
    0x0000001c  fade, cover left-up
    0x00000017  fade, cover right
    0x0000001a  fade, cover right-down
    0x0000001d  fade, cover right-up
    0x00000018  fade, cover up
    0xfbdffcd0  fade, little waves
    0xfbeffcd0  fade, pixel
    0x04000015  fade, uncover clockwise
    0x04000014  fade, uncover counter clockwise
    0x4013fd80  flip fold down
    0x4013ff40  flip fold left
    0x4013fe40  flip fold right
    0x4013fc80  flip fold up
    0x6381dcc0  meander
    0x6381dc00  meander [block style]
    0x0013fc00  oval in [block style]
    0x0013fd00  oval out [block style]
    0xc013fd00  pinwheel, clockwise
    0xc013fe00  pinwheel, counter clockwise
    0xc013fdc0  pinwheels, clockwise
    0xc013fec0  pinwheels, counter clockwise
    0x0400000f  push down
    0x0000000e  push left
    0x0400000e  push right
    0x0000000f  push up
    0xfbfffd40  random bars, horizontal
    0xfbfffd59  random bars, horizontal, cover down
    0xfbfffd58  random bars, horizontal, cover up
    0xfbfffd00  random bars, horizontal, large
    0xfbffff80  random bars, vertical
    0xfbffff96  random bars, vertical, cover left
    0xfbffff97  random bars, vertical, cover right
    0xfbffff00  random bars, vertical, large
    0x0153dfc0  rectangles, in
    0x0113fd00  rectangles, large, in
    0x1151df00  rectangles, large, in corners
    0x0153df00  rectangles, large, in sides
    0x0153dd00  rectangles, large, in top/bottom
    0x0113fe00  rectangles, large, out
    0x1151de00  rectangles, large, out corners
    0x0153de00  rectangles, large, out sides
    0x0153dc00  rectangles, large, out top/bottom
    0x0153dec0  rectangles, out
    0x04000003  scale in
    0x04000001  scale in, horizontal
    0x04000002  scale in, vertical
    0x00000003  scale out
    0x00000001  scale out, horizontal
    0x00000002  scale out, vertical
    0x83f7c040  scanlines, crossing horizontal
    0x83f7c280  scanlines, crossing vertical
    0x83f3c280  scanlines, down and back
    0xc3f3c040  scanlines, left and back
    0x83f3c040  scanlines, right and back
    0x83f7c284  scanlines, rotating
    0xc3f3c280  scanlines, up and back
    0x4111dd80  slice down
    0x4111df40  slice left
    0x4111de40  slice right
    0x4111dc80  slice up
    0x4381dc00  snake in
    0x4381dd00  snake out
    0x000fc280  split horizontal in
    0x000fc380  split horizontal out
    0x000fc040  split vertical in
    0x000fc140  split vertical out
    0x4111df00  strips left-down
    0x4111dc00  strips left-up
    0x4111dd00  strips right-down
    0x4111de00  strips right-up
    0x0013dd00  sunrise [block style]
    0x0013dc00  sunset [block style]
    0x4111ffc0  triangles down
    0x6111fdc0  triangles left
    0x4111fdc0  triangles right
    0x6111ffc0  triangles up
    0x04000008  uncover down
    0x04000007  uncover left
    0x0400000d  uncover left-down
    0x0400000a  uncover left-up
    0x04000006  uncover right
    0x0400000c  uncover right-down
    0x0400000b  uncover right-up
    0x04000009  uncover up
    0x4193dc00  unzip down
    0x4111fc00  unzip left
    0x4113de00  unzip right
    0x4113dc00  unzip up
    0x8113fcc0  waves down
    0xa111fcc0  waves down 2
    0x8113fec0  waves left
    0xa111fec0  waves left 2
    0x8113ffc0  waves right
    0x8111ffc0  waves right 2
    0x8113fdc0  waves up
    0x8111fdc0  waves up 2
    0x4013fd00  wedge down [block style]
    0x4013fc00  wedge up [block style]
    0x8013fc00  wheel clockwise, 1 spoke [block style]
    0x8013fd00  wheel counter clockwise, 1 spoke [block style]
    0x0007c280  wipe down
    0x0007c140  wipe left
    0x0007c040  wipe right
    0x0007c380  wipe up
    0x4011fe00  wiper, bottom [block style]
    0x6011fe00  wiper, top [block style]
    0x4113dd00  zip down
    0x4113df00  zip left
    0x4111fd00  zip right
    0x4193dd00  zip up

setXMLPlaylist | () | method |

`public function setXMLPlaylist(XMLPlaylist:*):void`

Sets an XML based playlist.

Parameters

| `XMLPlaylist:*` — A XML object or a string.

stop | () | method |

`public function stop(e:Event = null):void`

Action performed when the stop button is pressed.

Parameters

| `e:Event` (default = `null`)``

Event detail

cuePoint | event

Event object type: `flash.events.NetStatusEvent`

The cuePoint event is broadcasted when cuePoints are encountered inside a media file.

displayOut | event |

Event object type: `flash.events.Event`

The displayOut event is broadcasted when the mouse is moved out of the display object.

displayOver | event |

Event object type: `flash.events.Event`

The displayOver event is broadcasted when the mouse is moved over the display object.

itemComplete | event |

Event object type: `flash.events.Event`

The itemComplete event is broadcasted when the end of a media file has been reached.

itemLoad | event |

Event object type: `flash.events.Event`

The itemLoad event is broadcasted when the load of a playlist item has been initiated.

mediaInfo | event |

Event object type: `flash.events.NetStatusEvent`

The mediaInfo event is broadcasted when additional information is encountered inside a media file.

playlistComplete | event |

Event object type: `flash.events.Event`

The playlistComplete event is broadcasted when the end of the playlist has been reached and loop has been set to false.

playlistSet | event |

Event object type: `flash.events.Event`

The playlistSet event is broadcasted when a new playlist has been set.

Last update : 04/05/2008