1/***************************************************** 2* 3* Copyright 2009 Adobe Systems Incorporated. All Rights Reserved. 4* 5***************************************************** 6* The contents of this file are subject to the Mozilla Public License 7* Version 1.1 (the "License"); you may not use this file except in 8* compliance with the License. You may obtain a copy of the License at 9* http://www.mozilla.org/MPL/ 10* 11* Software distributed under the License is distributed on an "AS IS" 12* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 13* License for the specific language governing rights and limitations 14* under the License. 15* 16* 17* The Initial Developer of the Original Code is Adobe Systems Incorporated. 18* Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems 19* Incorporated. All Rights Reserved. 20* 21*****************************************************/ 22package org.osmf.events 23{ 24 import flash.events.Event; 25 26 /** 27 * A DRMEvent is dispatched when the properties of a DRMTrait change. 28 * 29 * @langversion 3.0 30 * @playerversion Flash 10.1 31 * @playerversion AIR 1.5 32 * @productversion OSMF 1.0 33 */ 34 public class DRMEvent extends Event 35 { 36 /** 37 * The DRMEvent.DRM_STATE_CHANGE constant defines the value 38 * of the type property of the event object for a change to the drmState 39 * of a DRMTrait. 40 * 41 * @eventType DRM_STATE_CHANGE 42 * 43 * @langversion 3.0 44 * @playerversion Flash 10.1 45 * @playerversion AIR 1.5 46 * @productversion OSMF 1.0 47 */ 48 public static const DRM_STATE_CHANGE:String = "drmStateChange"; 49 50 /** 51 * Constructor. 52 * 53 * @param type The type of the event. 54 * @param bubbles Specifies whether the event can bubble up the display list hierarchy. 55 * @param cancelable Specifies whether the behavior associated with the event can be prevented. 56 * @param licenseID Specified the unique identifier for this content 57 * @param prompt The authentication prompt associated with this content. 58 * @param mediaError The error that describes an authentication failure. 59 * 60 * @langversion 3.0 61 * @playerversion Flash 10.1 62 * @playerversion AIR 1.5 63 * @productversion OSMF 1.0 64 */ 65 public function DRMEvent(type:String, state:String, bubbles:Boolean=false, cancelable:Boolean=false, start:Date=null, end:Date=null, period:Number=0, serverURL:String=null, token:Object=null, mediaError:MediaError=null) 66 { 67 super(type, bubbles, cancelable); 68 69 _drmState = state; 70 _token = token; 71 _mediaError = mediaError; 72 _startDate = start; 73 _endDate = end; 74 _period = period; 75 _serverURL = serverURL; 76 } 77 78 /** 79 * The token returned as a result of a successful authentication. 80 * 81 * @langversion 3.0 82 * @playerversion Flash 10.1 83 * @playerversion AIR 1.5 84 * @productversion OSMF 1.0 85 */ 86 public function get token():Object 87 { 88 return _token; 89 } 90 91 /** 92 * The error that describes an authentication failure. 93 * 94 * @langversion 3.0 95 * @playerversion Flash 10.1 96 * @playerversion AIR 1.5 97 * @productversion OSMF 1.0 98 */ 99 public function get mediaError():MediaError 100 { 101 return _mediaError; 102 } 103 104 /** 105 * The start date for the playback window, null if authentication 106 * hasn't taken place. 107 * 108 * @langversion 3.0 109 * @playerversion Flash 10.1 110 * @playerversion AIR 1.5 111 * @productversion OSMF 1.0 112 */ 113 public function get startDate():Date 114 { 115 return _startDate; 116 } 117 118 /** 119 * The end date for the playback window, null if authentication 120 * hasn't taken place. 121 * 122 * @langversion 3.0 123 * @playerversion Flash 10.1 124 * @playerversion AIR 1.5 125 * @productversion OSMF 1.0 126 */ 127 public function get endDate():Date 128 { 129 return _endDate; 130 } 131 132 /** 133 * The length of the playback window, in seconds; NaN if 134 * authentication hasn't taken place. 135 * 136 * <p>Note that this property will generally be the difference between startDate 137 * and endDate, but is included as a property because there may be times where 138 * the duration is known up front, but the start or end dates are not (e.g. a 139 * one week rental).</p> 140 * 141 * @langversion 3.0 142 * @playerversion Flash 10.1 143 * @playerversion AIR 1.5 144 * @productversion OSMF 1.0 145 */ 146 public function get period():Number 147 { 148 return _period; 149 } 150 151 /** 152 * The current state of the DRM trait. Possible values 153 * are listed on the DRMState enumeration. 154 * 155 * @langversion 3.0 156 * @playerversion Flash 10.1 157 * @playerversion AIR 1.5 158 * @productversion OSMF 1.0 159 */ 160 public function get drmState():String 161 { 162 return _drmState; 163 } 164 165 /** 166 * The authentication prompt for the DRM content associated with this DRMEvent. For 167 * localized authentication, this may be an id. 168 */ 169 public function get serverURL():String 170 { 171 return _serverURL; 172 } 173 174 175 /** 176 * @private 177 */ 178 override public function clone():Event 179 { 180 return new DRMEvent(type, _drmState, bubbles, cancelable, _startDate, _endDate, _period, _serverURL, _token, _mediaError); 181 } 182 183 private var _drmState:String; 184 private var _startDate:Date; 185 private var _endDate:Date; 186 private var _period:Number; 187 private var _serverURL:String; 188 private var _token:Object; 189 private var _mediaError:MediaError; 190 } 191}