| 1 | package com.longtailvideo.jwplayer.events { |
|---|
| 2 | import flash.events.Event; |
|---|
| 3 | |
|---|
| 4 | /** |
|---|
| 5 | * The MediaEvent class represents events related to media playback. |
|---|
| 6 | * |
|---|
| 7 | * @see com.longtailvideo.media.MediaProvider |
|---|
| 8 | */ |
|---|
| 9 | public class MediaEvent extends PlayerEvent { |
|---|
| 10 | |
|---|
| 11 | /** |
|---|
| 12 | * The <code>MediaEvent.JWPLAYER_MEDIA_BUFFER</code> constant defines the value of the |
|---|
| 13 | * <code>type</code> property of the event object for a <code>jwplayerMediaBuffer</code> event. |
|---|
| 14 | * |
|---|
| 15 | * <p>The properties of the event object have the following values:</p> |
|---|
| 16 | * <table class="innertable"> |
|---|
| 17 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 18 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 19 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 20 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 21 | * <tr><td><code>buffer</code></td><td>The percent of the media buffered into memory</td></tr> |
|---|
| 22 | * </table> |
|---|
| 23 | * |
|---|
| 24 | * @eventType jwplayerMediaBuffer |
|---|
| 25 | */ |
|---|
| 26 | public static var JWPLAYER_MEDIA_BUFFER:String = "jwplayerMediaBuffer"; |
|---|
| 27 | |
|---|
| 28 | /** |
|---|
| 29 | * The <code>MediaEvent.JWPLAYER_MEDIA_BUFFER_FULL</code> constant defines the value of the |
|---|
| 30 | * <code>type</code> property of the event object for a <code>jwplayerMediaBufferFull</code> event. |
|---|
| 31 | * |
|---|
| 32 | * <p>The properties of the event object have the following values:</p> |
|---|
| 33 | * <table class="innertable"> |
|---|
| 34 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 35 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 36 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 37 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 38 | * <tr><td><code>buffer</code></td><td>The percent of the media buffered into memory</td></tr> |
|---|
| 39 | * </table> |
|---|
| 40 | * |
|---|
| 41 | * @eventType jwplayerMediaBufferFull |
|---|
| 42 | */ |
|---|
| 43 | public static var JWPLAYER_MEDIA_BUFFER_FULL:String = "jwplayerMediaBufferFull"; |
|---|
| 44 | |
|---|
| 45 | /** |
|---|
| 46 | * The <code>MediaEvent.JWPLAYER_MEDIA_ERROR</code> constant defines the value of the |
|---|
| 47 | * <code>type</code> property of the event object for a <code>jwplayerMediaError</code> event. |
|---|
| 48 | * |
|---|
| 49 | * <p>The properties of the event object have the following values:</p> |
|---|
| 50 | * <table class="innertable"> |
|---|
| 51 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 52 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 53 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 54 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 55 | * <tr><td><code>message</code></td><td>Message explaining the error.</td></tr> |
|---|
| 56 | * </table> |
|---|
| 57 | * |
|---|
| 58 | * @eventType jwplayerMediaError |
|---|
| 59 | */ |
|---|
| 60 | public static var JWPLAYER_MEDIA_ERROR:String = "jwplayerMediaError"; |
|---|
| 61 | |
|---|
| 62 | /** |
|---|
| 63 | * The <code>MediaEvent.JWPLAYER_MEDIA_LOADED</code> constant defines the value of the |
|---|
| 64 | * <code>type</code> property of the event object for a <code>jwplayerMediaLoaded</code> event. |
|---|
| 65 | * |
|---|
| 66 | * <p>The properties of the event object have the following values:</p> |
|---|
| 67 | * <table class="innertable"> |
|---|
| 68 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 69 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 70 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 71 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 72 | * </table> |
|---|
| 73 | * |
|---|
| 74 | * @eventType jwplayerMediaLoaded |
|---|
| 75 | */ |
|---|
| 76 | public static var JWPLAYER_MEDIA_LOADED:String = "jwplayerMediaLoaded"; |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * The <code>MediaEvent.JWPLAYER_MEDIA_COMPLETE</code> constant defines the value of the |
|---|
| 80 | * <code>type</code> property of the event object for a <code>jwplayerMediaComplete</code> event. |
|---|
| 81 | * |
|---|
| 82 | * <p>The properties of the event object have the following values:</p> |
|---|
| 83 | * <table class="innertable"> |
|---|
| 84 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 85 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 86 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 87 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 88 | * </table> |
|---|
| 89 | * |
|---|
| 90 | * @eventType jwplayerMediaComplete |
|---|
| 91 | */ |
|---|
| 92 | public static var JWPLAYER_MEDIA_COMPLETE:String = "jwplayerMediaComplete"; |
|---|
| 93 | |
|---|
| 94 | /** |
|---|
| 95 | * The <code>MediaEvent.JWPLAYER_MEDIA_TIME</code> constant defines the value of the |
|---|
| 96 | * <code>type</code> property of the event object for a <code>jwplayerMediaTime</code> event. |
|---|
| 97 | * |
|---|
| 98 | * <p>The properties of the event object have the following values:</p> |
|---|
| 99 | * <table class="innertable"> |
|---|
| 100 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 101 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 102 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 103 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 104 | * <tr><td><code>position</code></td><td>Number of seconds elapsed since the start of the media playback.</td></tr> |
|---|
| 105 | * <tr><td><code>duration</code></td><td>Total number of seconds in the currently loaded media.</td></tr> |
|---|
| 106 | * </table> |
|---|
| 107 | * |
|---|
| 108 | * @eventType jwplayerMediaTime |
|---|
| 109 | */ |
|---|
| 110 | public static var JWPLAYER_MEDIA_TIME:String = "jwplayerMediaTime"; |
|---|
| 111 | |
|---|
| 112 | /** |
|---|
| 113 | * The <code>MediaEvent.JWPLAYER_MEDIA_VOLUME</code> constant defines the value of the |
|---|
| 114 | * <code>type</code> property of the event object for a <code>jwplayerMediaVolume</code> event. |
|---|
| 115 | * |
|---|
| 116 | * <p>The properties of the event object have the following values:</p> |
|---|
| 117 | * <table class="innertable"> |
|---|
| 118 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 119 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 120 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 121 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 122 | * <tr><td><code>duration</code></td><td>The current playback volume, between 0 and 100.</td></tr> |
|---|
| 123 | * </table> |
|---|
| 124 | * |
|---|
| 125 | * @eventType jwplayerMediaVolume |
|---|
| 126 | */ |
|---|
| 127 | public static var JWPLAYER_MEDIA_VOLUME:String = "jwplayerMediaVolume"; |
|---|
| 128 | |
|---|
| 129 | /** |
|---|
| 130 | * The <code>MediaEvent.JWPLAYER_MEDIA_META</code> constant defines the value of the |
|---|
| 131 | * <code>type</code> property of the event object for a <code>jwplayerMediaMeta</code> event. |
|---|
| 132 | * |
|---|
| 133 | * <p>The properties of the event object have the following values:</p> |
|---|
| 134 | * <table class="innertable"> |
|---|
| 135 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 136 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 137 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 138 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 139 | * <tr><td><code>duration</code></td><td>The current playback volume, between 0 and 100.</td></tr> |
|---|
| 140 | * </table> |
|---|
| 141 | * |
|---|
| 142 | * @eventType jwplayerMediaMeta |
|---|
| 143 | */ |
|---|
| 144 | public static var JWPLAYER_MEDIA_META:String = "jwplayerMediaMeta"; |
|---|
| 145 | |
|---|
| 146 | /** |
|---|
| 147 | * The <code>MediaEvent.JWPLAYER_MEDIA_MUTE</code> constant defines the value of the |
|---|
| 148 | * <code>type</code> property of the event object for a <code>jwplayerMediaMute</code> event. |
|---|
| 149 | * |
|---|
| 150 | * <p>The properties of the event object have the following values:</p> |
|---|
| 151 | * <table class="innertable"> |
|---|
| 152 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 153 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 154 | * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> |
|---|
| 155 | * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> |
|---|
| 156 | * <tr><td><code>duration</code></td><td>The current playback volume, between 0 and 100.</td></tr> |
|---|
| 157 | * </table> |
|---|
| 158 | * |
|---|
| 159 | * @eventType jwplayerMediaMute |
|---|
| 160 | */ |
|---|
| 161 | public static var JWPLAYER_MEDIA_MUTE:String = "jwplayerMediaMute"; |
|---|
| 162 | |
|---|
| 163 | public var bufferPercent:Number = -1; |
|---|
| 164 | public var duration:Number = -1; |
|---|
| 165 | public var metadata:Object = {}; |
|---|
| 166 | public var position:Number = -1; |
|---|
| 167 | public var offset:Number = -1; |
|---|
| 168 | public var volume:Number = -1; |
|---|
| 169 | public var mute:Boolean = false; |
|---|
| 170 | |
|---|
| 171 | public function MediaEvent(type:String) { |
|---|
| 172 | super(type); |
|---|
| 173 | } |
|---|
| 174 | |
|---|
| 175 | public override function clone():Event { |
|---|
| 176 | var evt:MediaEvent = new MediaEvent(this.type); |
|---|
| 177 | evt.bufferPercent = this.bufferPercent; |
|---|
| 178 | evt.duration = this.duration; |
|---|
| 179 | evt.metadata = this.metadata; |
|---|
| 180 | evt.position = this.position; |
|---|
| 181 | evt.offset = this.offset; |
|---|
| 182 | evt.volume = this.volume; |
|---|
| 183 | evt.mute = this.mute; |
|---|
| 184 | return evt; |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | public override function toString():String { |
|---|
| 188 | return '[MediaEvent type="' + type + '"' |
|---|
| 189 | + ' bufferPercent="' + bufferPercent + '"' |
|---|
| 190 | + ' duration="' + duration + '"' |
|---|
| 191 | + ' position="' + position + '"' |
|---|
| 192 | + ' offset="' + offset + '"' |
|---|
| 193 | + ' volume="' + volume + '"' |
|---|
| 194 | + ' mute="' + mute + '"' |
|---|
| 195 | + ' message="' + message + '"' |
|---|
| 196 | + ' id="' + id + '"' |
|---|
| 197 | + ' client="' + client + '"' |
|---|
| 198 | + ' version="' + version + '"' |
|---|
| 199 | + "]"; |
|---|
| 200 | } |
|---|
| 201 | } |
|---|
| 202 | } |
|---|