| 1 | package com.longtailvideo.jwplayer.events { |
|---|
| 2 | import com.longtailvideo.jwplayer.player.Player; |
|---|
| 3 | |
|---|
| 4 | import flash.events.Event; |
|---|
| 5 | import flash.external.ExternalInterface; |
|---|
| 6 | import flash.system.Capabilities; |
|---|
| 7 | |
|---|
| 8 | /** |
|---|
| 9 | * Event class thrown by the Player |
|---|
| 10 | * |
|---|
| 11 | * @see com.longtailvideo.jwplayer.player.Player |
|---|
| 12 | * @author Pablo Schklowsky |
|---|
| 13 | */ |
|---|
| 14 | public class PlayerEvent extends Event { |
|---|
| 15 | |
|---|
| 16 | /** |
|---|
| 17 | * The PlayerEvent.JWPLAYER_READY constant defines the value of the |
|---|
| 18 | * <code>type</code> property of the event object |
|---|
| 19 | * for a <code>jwplayerReady</code> event. |
|---|
| 20 | * |
|---|
| 21 | * <p>The properties of the event object have the following values:</p> |
|---|
| 22 | * <table class="innertable"> |
|---|
| 23 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 24 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 25 | * <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> |
|---|
| 26 | * <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> |
|---|
| 27 | * </table> |
|---|
| 28 | * |
|---|
| 29 | * @see com.longtailvideo.jwplayer.player.Player |
|---|
| 30 | * @eventType jwplayerReady |
|---|
| 31 | */ |
|---|
| 32 | public static var JWPLAYER_READY:String = "jwplayerReady"; |
|---|
| 33 | |
|---|
| 34 | /** |
|---|
| 35 | * The PlayerEvent.JWPLAYER_ERROR constant defines the value of the |
|---|
| 36 | * <code>type</code> property of the event object |
|---|
| 37 | * for a <code>jwplayerError</code> event. |
|---|
| 38 | * |
|---|
| 39 | * <table class="innertable"> |
|---|
| 40 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 41 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 42 | * <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> |
|---|
| 43 | * <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> |
|---|
| 44 | * <tr><td><code>message</code></td><td>Message explaining the cause of the error</td></tr> |
|---|
| 45 | * </table> |
|---|
| 46 | * |
|---|
| 47 | * @see com.longtailvideo.jwplayer.player.Player |
|---|
| 48 | * @eventType jwplayerError |
|---|
| 49 | */ |
|---|
| 50 | public static var JWPLAYER_ERROR:String = "jwplayerError"; |
|---|
| 51 | |
|---|
| 52 | /** |
|---|
| 53 | * The PlayerEvent.JWPLAYER_ERROR constant defines the value of the |
|---|
| 54 | * <code>type</code> property of the event object |
|---|
| 55 | * for a <code>jwplayerError</code> event. |
|---|
| 56 | * |
|---|
| 57 | * <table class="innertable"> |
|---|
| 58 | * <tr><th>Property</th><th>Value</th></tr> |
|---|
| 59 | * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> |
|---|
| 60 | * <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> |
|---|
| 61 | * <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> |
|---|
| 62 | * <tr><td><code>message</code></td><td>Message explaining the cause of the error</td></tr> |
|---|
| 63 | * </table> |
|---|
| 64 | * |
|---|
| 65 | * @see com.longtailvideo.jwplayer.player.Player |
|---|
| 66 | * @eventType jwplayerState |
|---|
| 67 | */ |
|---|
| 68 | public static var JWPLAYER_STATE:String = "jwplayerState"; |
|---|
| 69 | |
|---|
| 70 | public var id:String; |
|---|
| 71 | public var client:String; |
|---|
| 72 | public var version:String; |
|---|
| 73 | |
|---|
| 74 | public var message:String; |
|---|
| 75 | |
|---|
| 76 | public function PlayerEvent(type:String, msg:String=undefined) { |
|---|
| 77 | super(type, false, false); |
|---|
| 78 | |
|---|
| 79 | try { |
|---|
| 80 | if (ExternalInterface.available) { |
|---|
| 81 | this.id = ExternalInterface.objectID; |
|---|
| 82 | } |
|---|
| 83 | this.client = "FLASH" + Capabilities.version; |
|---|
| 84 | this.version = Player.version; |
|---|
| 85 | } catch (e:Error) {} |
|---|
| 86 | this.message = msg; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | } |
|---|
| 90 | } |
|---|