//-----------------------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------
// SilverlightMedia.js
// MediaPlayer component
Type.registerNamespace('Sys.UI.Silverlight');
Sys.UI.Silverlight._DomElement = function Sys$UI$Silverlight$_DomElement(element, visible) {
Sys.Debug.assert(!!element, "DomElement requires an element.");
Sys.Debug.assert(!!element.Name, "DomElement requires an element with a name.");
this._element = element;
this._visible = !!visible;
this._bindAutoAnimations(element, element.Name);
}
function Sys$UI$Silverlight$_DomElement$get_element() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._element;
}
function Sys$UI$Silverlight$_DomElement$get_enabled() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._enabled;
}
function Sys$UI$Silverlight$_DomElement$set_enabled(value) {
if (value !== this.get_enabled()) {
this._enabled = value;
this._play(value ? "enable" : "disable");
if (!value && this._mouseOver) {
this._play("leave");
this._mouseOver = false;
}
}
}
function Sys$UI$Silverlight$_DomElement$get_visible() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._visible;
}
function Sys$UI$Silverlight$_DomElement$set_visible(value) {
if (value !== this.get_visible()) {
this._visible = value;
if (!this._play(value ? "show" : "hide")) {
this.get_element().visibility = value ? 0 : 1;
}
}
}
function Sys$UI$Silverlight$_DomElement$_bindAutoAnimations(element, name) {
this._animations = {
"show": element.findName(name + "_Show"),
"hide": element.findName(name + "_Hide"),
"enable": element.findName(name + "_Enable"),
"disable": element.findName(name + "_Disable"),
"leave": element.findName(name + "_MouseLeave")
}
if (this._animations["leave"]) {
this.bindEvent("mouseEnter", name + "_MouseEnter", this._onEnter);
this.bindEvent("mouseLeave", name + "_MouseLeave", this._onLeave);
}
}
function Sys$UI$Silverlight$_DomElement$bindEvent(eventName, animationName, callback, callbackOwner) {
Sys.Debug.assert(!!(animationName || callback), "bindEvent requires at least an animation name or callback.");
var element = this.get_element();
var animation = null;
if (animationName) {
animation = element.findName(animationName);
}
if (!animation && !callback) return;
if (callback) {
callback = Function.createDelegate(callbackOwner || this, callback);
}
var handler = this._createEventHandler(animation, callback);
var token = element.addEventListener(eventName, handler);
if (!this._events) {
this._events = [];
}
this._events[this._events.length] = { eventName: eventName, token: token };
}
function Sys$UI$Silverlight$_DomElement$_createEventHandler(animation, callback) {
return Function.createDelegate(this,
function(sender, args) {
if (!this.get_enabled()) return;
if (callback && !callback(sender, args)) return;
if (animation) {
animation.begin();
}
});
}
function Sys$UI$Silverlight$_DomElement$dispose() {
if (this._events) {
var element = this.get_element();
for (var i = 0, l = this._events.length; i < l; i++) {
var e = this._events[i];
element.removeEventListener(e.eventName, e.token);
}
this._events = null;
}
this._animations = null;
this._element = null;
}
function Sys$UI$Silverlight$_DomElement$_onEnter() {
this._mouseOver = true;
return true;
}
function Sys$UI$Silverlight$_DomElement$_onLeave() {
this._mouseOver = false;
return true;
}
function Sys$UI$Silverlight$_DomElement$_play(name) {
var a = this._animations[name];
if (a) {
a.begin();
return true;
}
return false;
}
Sys.UI.Silverlight._DomElement.prototype = {
_events: null,
_animations: null,
_enabled: true,
_mouseOver: false,
get_element: Sys$UI$Silverlight$_DomElement$get_element,
get_enabled: Sys$UI$Silverlight$_DomElement$get_enabled,
set_enabled: Sys$UI$Silverlight$_DomElement$set_enabled,
get_visible: Sys$UI$Silverlight$_DomElement$get_visible,
set_visible: Sys$UI$Silverlight$_DomElement$set_visible,
_bindAutoAnimations: Sys$UI$Silverlight$_DomElement$_bindAutoAnimations,
bindEvent: Sys$UI$Silverlight$_DomElement$bindEvent,
_createEventHandler: Sys$UI$Silverlight$_DomElement$_createEventHandler,
dispose: Sys$UI$Silverlight$_DomElement$dispose,
_onEnter: Sys$UI$Silverlight$_DomElement$_onEnter,
_onLeave: Sys$UI$Silverlight$_DomElement$_onLeave,
_play: Sys$UI$Silverlight$_DomElement$_play
}
Sys.UI.Silverlight._DomElement.registerClass('Sys.UI.Silverlight._DomElement', null, Sys.IDisposable);
Sys.UI.Silverlight._Button = function Sys$UI$Silverlight$_Button(element, visible, repeatInterval, clickCallback,
doubleClickCallback, callbackOwner, states) {
Sys.Debug.assert((typeof(repeatInterval) === "undefined") || (repeatInterval >= 0));
if (doubleClickCallback) Sys.Debug.assert(!!clickCallback, "Double click callback without click callback.");
Sys.UI.Silverlight._Button.initializeBase(this, [element, visible]);
element.cursor = "Hand";
this._repeatInterval = repeatInterval;
this._clickDelegate = clickCallback ? Function.createDelegate(callbackOwner, clickCallback) : null;
this._doubleClickDelegate = doubleClickCallback ? Function.createDelegate(callbackOwner, doubleClickCallback) : null;
this._elements = [];
if (states) {
for (var i = 0; i < states.length; i++) {
var e = element.findName(states[i]);
this._elements[i] = e ? new Sys.UI.Silverlight._DomElement(e, i === 0) : null;
}
}
}
function Sys$UI$Silverlight$_Button$set_enabled(value) {
Sys.UI.Silverlight._Button.callBaseMethod(this, "set_enabled", [value]);
this.get_element().cursor = value ? "Hand" : "Default";
}
function Sys$UI$Silverlight$_Button$get_state() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._state;
}
function Sys$UI$Silverlight$_Button$set_state(value) {
Sys.Debug.assert(value >= 0 && value < this._elements.length, "State out of range");
if (value === this.get_state()) return;
var e = this._elements[this._state];
if (e) {
e.set_visible(false);
}
this._state = value;
e = this._elements[this._state];
if (e) {
e.set_visible(true);
}
}
function Sys$UI$Silverlight$_Button$_bindAutoAnimations(element, name) {
Sys.UI.Silverlight._Button.callBaseMethod(this, "_bindAutoAnimations", [element, name]);
this.bindEvent("mouseLeftButtonDown", name + "_MouseDown", this._mouseDown);
this.bindEvent("mouseLeftButtonUp", name + "_MouseUp", this._mouseUp);
this.bindEvent("mouseLeave", name + "_MouseUp", this._mouseLeave);
}
function Sys$UI$Silverlight$_Button$_cancelRepeat() {
window.clearTimeout(this._repeatTimeout);
this._repeatTimeout = null;
}
function Sys$UI$Silverlight$_Button$dispose() {
this._cancelRepeat();
if (this._elements) {
for (var i = 0, l = this._elements.length; i < l; i++) {
var e = this._elements[i];
if (e) {
e.dispose();
}
}
this._elements = null;
}
Sys.UI.Silverlight._Button.callBaseMethod(this, 'dispose');
}
function Sys$UI$Silverlight$_Button$_doClick(isDouble) {
if (isDouble && this._doubleClickDelegate) {
this._doubleClickDelegate(this);
}
else if (this._clickDelegate) {
this._clickDelegate(this);
}
}
function Sys$UI$Silverlight$_Button$_mouseDown() {
this._down = true;
if (this._repeatInterval && !this._repeatTimeout) {
this._doClick(false);
this._repeatClickDelegate = Function.createDelegate(this, this._repeatClick);
this._repeatTimeout = window.setTimeout(this._repeatClickDelegate, 500);
}
return true;
}
function Sys$UI$Silverlight$_Button$_mouseLeave() {
if (!this._down) {
return false;
}
this._down = false;
this._cancelRepeat();
return true;
}
function Sys$UI$Silverlight$_Button$_mouseUp() {
this._down = false;
if (this._repeatTimeout) {
this._cancelRepeat();
}
else {
var last = this._last;
this._last = new Date();
var doubleClick = last && ((this._last - last) < 300);
if (doubleClick) {
this._last = 0;
}
this._doClick(doubleClick);
}
return true;
}
function Sys$UI$Silverlight$_Button$_repeatClick() {
this._repeatTimeout = window.setTimeout(this._repeatClickDelegate, this._repeatInterval);
this._doClick(false);
}
Sys.UI.Silverlight._Button.prototype = {
_down: false,
_last: 0,
_state: 0,
_repeatTimeout: null,
_repeatClickDelegate: null,
set_enabled: Sys$UI$Silverlight$_Button$set_enabled,
get_state: Sys$UI$Silverlight$_Button$get_state,
set_state: Sys$UI$Silverlight$_Button$set_state,
_bindAutoAnimations: Sys$UI$Silverlight$_Button$_bindAutoAnimations,
_cancelRepeat: Sys$UI$Silverlight$_Button$_cancelRepeat,
dispose: Sys$UI$Silverlight$_Button$dispose,
_doClick: Sys$UI$Silverlight$_Button$_doClick,
_mouseDown: Sys$UI$Silverlight$_Button$_mouseDown,
_mouseLeave: Sys$UI$Silverlight$_Button$_mouseLeave,
_mouseUp: Sys$UI$Silverlight$_Button$_mouseUp,
_repeatClick: Sys$UI$Silverlight$_Button$_repeatClick
}
Sys.UI.Silverlight._Button.registerClass('Sys.UI.Silverlight._Button', Sys.UI.Silverlight._DomElement);
Sys.UI.Silverlight._Slider = function Sys$UI$Silverlight$_Slider(element, thumbElementName, visible, changedCallback, callbackOwner) {
Sys.Debug.assert(!!element, "Slider requires an element.");
this._horizontal = (element.width >= element.height);
var thumbElement = element.findName(thumbElementName);
if (!thumbElement) {
throw Error.invalidOperation(String.format(Sys.UI.Silverlight.MediaRes.noThumbElement, element.Name, thumbElementName));
}
Sys.UI.Silverlight._Slider.initializeBase(this, [element, visible]);
this._changedHandler = callbackOwner ? Function.createDelegate(callbackOwner, changedCallback) : null;
element.cursor = "Hand";
thumbElement.cursor = "Hand";
this._thumb = new Sys.UI.Silverlight._DomElement(thumbElement, true);
this._thumb.bindEvent("mouseLeftButtonDown", null, this._thumbDown, this);
this._thumb.bindEvent("mouseLeftButtonUp", null, this._thumbUp, this);
this._thumb.bindEvent("mouseMove", null, this._thumbMove, this);
this.bindEvent("mouseLeftButtonDown", null, this._sliderDown);
var root = element.getHost().content.root;
this._rootToken = root.addEventListener("mouseLeave", Function.createDelegate(this, this._thumbUp));
}
function Sys$UI$Silverlight$_Slider$set_enabled(value) {
if (this.get_enabled() !== value) {
Sys.UI.Silverlight._Slider.callBaseMethod(this, "set_enabled", [value]);
if (!value) {
this.set_value(0);
}
this.get_element().cursor = value ? "Hand" : "Default";
if (this._highlight) {
this._highlight.set_enabled(value);
}
this._thumb.set_visible(value);
this._thumb.get_element().cursor = value ? "Hand" : "Default";
}
}
function Sys$UI$Silverlight$_Slider$get_readOnly() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._readOnly;
}
function Sys$UI$Silverlight$_Slider$set_readOnly(value) {
if (value !== this._readOnly) {
this._readOnly = value;
this._stopDragging();
}
}
function Sys$UI$Silverlight$_Slider$get_value() {
if (arguments.length !== 0) throw Error.parameterCount();
var val;
var thumb = this._thumb.get_element();
var slider = this.get_element();
if (this._horizontal) {
val = (thumb["Canvas.Left"] - slider["Canvas.Left"]) / (slider.width - thumb.width);
}
else {
val = thumb["Canvas.Top"] - slider["Canvas.Top"];
val = 1 - (val / (slider.height - thumb.height));
}
val = Math.round(val*1000)/1000;
return Math.min(1, Math.max(0, val));
}
function Sys$UI$Silverlight$_Slider$set_value(value) {
this._last = null;
if (!this._dragging) {
value = Math.max(0, Math.min(1, value));
this._setThumbPosition(value);
}
}
function Sys$UI$Silverlight$_Slider$_bindAutoAnimations(element, name) {
Sys.UI.Silverlight._Slider.callBaseMethod(this, "_bindAutoAnimations", [element, name]);
var e = element.findName(name + "_Highlight");
if (e) {
e[this._horizontal ? "width" : "height"] = 0;
this._highlight = new Sys.UI.Silverlight._DomElement(e, true);
}
else {
this._highlight = null;
}
}
function Sys$UI$Silverlight$_Slider$_detectChanged(value) {
if ((value !== this._last) && this._changedHandler) {
this._last = value;
this._changedHandler(this);
}
}
function Sys$UI$Silverlight$_Slider$dispose() {
if (this._thumb) {
this._thumb.dispose();
this._thumb = null;
}
if (this._highlight) {
this._highlight.dispose();
this._highlight = null;
}
if (this._rootToken !== null) {
this.get_element().getHost().content.root.removeEventListener("mouseLeave", this._rootToken);
this._rootToken = null;
}
Sys.UI.Silverlight._Slider.callBaseMethod(this, 'dispose');
}
function Sys$UI$Silverlight$_Slider$_setThumbPosition(value) {
var loc = this._toLocation(value);
var thumb = this._thumb.get_element();
var slider = this.get_element();
var h = this._highlight ? this._highlight.get_element() : null;
if (this._horizontal) {
thumb["Canvas.Left"] = loc + slider["Canvas.Left"] - (thumb.width / 2);
if (h) {
h.width = loc;
}
}
else {
thumb["Canvas.Top"] = loc + slider["Canvas.Top"] - (thumb.height / 2);
if (h) {
h["Canvas.Top"] = slider["Canvas.Top"] + loc;
h.height = slider.height - loc + (thumb.height / 2);
}
}
}
function Sys$UI$Silverlight$_Slider$_sliderDown(sender, eventArgs) {
if (this._readOnly) return false;
var newValue = this._toValue(eventArgs.getPosition(sender));
this._setThumbPosition(newValue);
this._detectChanged(newValue);
this._startDragging();
return true;
}
function Sys$UI$Silverlight$_Slider$_startDragging() {
this._dragging = true;
this._thumb.get_element().CaptureMouse();
}
function Sys$UI$Silverlight$_Slider$_stopDragging() {
if (this._dragging) {
this._thumb.get_element().ReleaseMouseCapture();
this._dragging = false;
}
}
function Sys$UI$Silverlight$_Slider$_thumbDown() {
if (this._readOnly) return false;
this._startDragging();
return true;
}
function Sys$UI$Silverlight$_Slider$_thumbUp() {
if (this._readOnly) return false;
if (this._dragging) {
this._detectChanged(this.get_value());
}
this._stopDragging();
return true;
}
function Sys$UI$Silverlight$_Slider$_thumbMove(sender, args) {
if (this._dragging) {
this._setThumbPosition(this._toValue(args.getPosition(this.get_element())));
}
return true;
}
function Sys$UI$Silverlight$_Slider$_toLocation(value) {
value = Math.min(1, Math.max(0, value));
var thumb = this._thumb.get_element();
var slider = this.get_element();
var range;
if (this._horizontal) {
range = slider.width - thumb.width;
return (thumb.width / 2) + (value * range);
}
else {
range = slider.height - thumb.height;
return (thumb.height / 2) + ((1-value) * range);
}
}
function Sys$UI$Silverlight$_Slider$_toValue(point) {
var val;
var thumb = this._thumb.get_element();
var slider = this.get_element();
if (this._horizontal) {
val = (point.X - (thumb.width / 2)) / (slider.width - thumb.width);
}
else {
val = (point.Y - (thumb.height / 2)) / (slider.height - thumb.height);
val = 1 - val;
}
val = Math.round(val*1000)/1000;
return Math.min(1, Math.max(0, val));
}
Sys.UI.Silverlight._Slider.prototype = {
_readOnly: false,
_dragging: false,
_last: null,
set_enabled: Sys$UI$Silverlight$_Slider$set_enabled,
get_readOnly: Sys$UI$Silverlight$_Slider$get_readOnly,
set_readOnly: Sys$UI$Silverlight$_Slider$set_readOnly,
get_value: Sys$UI$Silverlight$_Slider$get_value,
set_value: Sys$UI$Silverlight$_Slider$set_value,
_bindAutoAnimations: Sys$UI$Silverlight$_Slider$_bindAutoAnimations,
_detectChanged: Sys$UI$Silverlight$_Slider$_detectChanged,
dispose: Sys$UI$Silverlight$_Slider$dispose,
_setThumbPosition: Sys$UI$Silverlight$_Slider$_setThumbPosition,
_sliderDown: Sys$UI$Silverlight$_Slider$_sliderDown,
_startDragging: Sys$UI$Silverlight$_Slider$_startDragging,
_stopDragging: Sys$UI$Silverlight$_Slider$_stopDragging,
_thumbDown: Sys$UI$Silverlight$_Slider$_thumbDown,
_thumbUp: Sys$UI$Silverlight$_Slider$_thumbUp,
_thumbMove: Sys$UI$Silverlight$_Slider$_thumbMove,
_toLocation: Sys$UI$Silverlight$_Slider$_toLocation,
_toValue: Sys$UI$Silverlight$_Slider$_toValue
}
Sys.UI.Silverlight._Slider.registerClass('Sys.UI.Silverlight._Slider', Sys.UI.Silverlight._DomElement);
Sys.UI.Silverlight._TextBlock = function Sys$UI$Silverlight$_TextBlock(element, bgElement, visible) {
Sys.UI.Silverlight._TextBlock.initializeBase(this, [element, visible]);
if (bgElement) {
this._bg = new Sys.UI.Silverlight._DomElement(bgElement, visible);
this._centerX = bgElement["Canvas.Left"] + bgElement.width / 2;
this._bottomY = bgElement["Canvas.Top"] + bgElement.height;
}
else {
this._bg = null;
this._centerX = element["Canvas.Left"] + element.ActualWidth / 2;
this._bottomY = element["Canvas.Top"] + element.ActualHeight;
}
}
function Sys$UI$Silverlight$_TextBlock$get_text() {
if (arguments.length !== 0) throw Error.parameterCount();
return this.get_element().Text || "";
}
function Sys$UI$Silverlight$_TextBlock$set_text(value) {
var element = this.get_element();
element.Text = value || "";
this.set_visible(!!value);
var bg = this._bg ? this._bg.get_element() : element;
bg.width = element.ActualWidth;
bg.height = element.ActualHeight;
bg["Canvas.Left"] = this._centerX - bg.width / 2;
bg["Canvas.Top"] = this._bottomY - bg.height;
}
function Sys$UI$Silverlight$_TextBlock$set_visible(value) {
Sys.UI.Silverlight._TextBlock.callBaseMethod(this, "set_visible", [value]);
if (this._bg) {
this._bg.set_visible(value);
}
}
function Sys$UI$Silverlight$_TextBlock$dispose() {
Sys.UI.Silverlight._TextBlock.callBaseMethod(this, "dispose");
if (this._bg) {
this._bg.dispose();
}
}
Sys.UI.Silverlight._TextBlock.prototype = {
get_text: Sys$UI$Silverlight$_TextBlock$get_text,
set_text: Sys$UI$Silverlight$_TextBlock$set_text,
set_visible: Sys$UI$Silverlight$_TextBlock$set_visible,
dispose: Sys$UI$Silverlight$_TextBlock$dispose
}
Sys.UI.Silverlight._TextBlock.registerClass('Sys.UI.Silverlight._TextBlock', Sys.UI.Silverlight._DomElement);
Sys.UI.Silverlight._ProgressBar = function Sys$UI$Silverlight$_ProgressBar(element, textElement, visible) {
Sys.UI.Silverlight._ProgressBar.initializeBase(this, [element, visible]);
this._fullWidth = element.width;
element.width = 0;
if (textElement) {
this._text = new Sys.UI.Silverlight._TextBlock(textElement, null, visible);
this._text.set_text("");
}
else {
this._text = null;
}
}
function Sys$UI$Silverlight$_ProgressBar$get_value() {
if (arguments.length !== 0) throw Error.parameterCount();
var val = this._fullWidth !== 0 ? (this.get_element().width / this._fullWidth) : 0;
return Math.round(val * 1000) / 1000;
}
function Sys$UI$Silverlight$_ProgressBar$set_value(value) {
this.get_element().width = this._fullWidth * value;
if (this._text) {
this._text.set_text("" + Math.floor(value * 100));
}
}
function Sys$UI$Silverlight$_ProgressBar$set_visible(value) {
Sys.UI.Silverlight._ProgressBar.callBaseMethod(this, "set_visible", [value]);
if (this._text) {
this._text.set_visible(value);
}
}
function Sys$UI$Silverlight$_ProgressBar$dispose() {
Sys.UI.Silverlight._ProgressBar.callBaseMethod(this, "dispose");
if (this._text) {
this._text.dispose();
}
}
Sys.UI.Silverlight._ProgressBar.prototype = {
get_value: Sys$UI$Silverlight$_ProgressBar$get_value,
set_value: Sys$UI$Silverlight$_ProgressBar$set_value,
set_visible: Sys$UI$Silverlight$_ProgressBar$set_visible,
dispose: Sys$UI$Silverlight$_ProgressBar$dispose
}
Sys.UI.Silverlight._ProgressBar.registerClass('Sys.UI.Silverlight._ProgressBar', Sys.UI.Silverlight._DomElement);
Sys.UI.Silverlight._ImageList = function Sys$UI$Silverlight$_ImageList(element, toggleElement, visible, itemClickCallback, callbackOwner) {
Sys.Debug.assert(!!(itemClickCallback && callbackOwner), "Callback and callback owner must be given.");
Sys.UI.Silverlight._ImageList.initializeBase(this, [element, visible]);
this._toggle = toggleElement ?
new Sys.UI.Silverlight._Button(toggleElement, visible, 0, this._onToggle, null, this) :
null;
this._itemClickDelegate = Function.createDelegate(callbackOwner, itemClickCallback);
this._virtualItems = [];
this._imageItems = [];
}
function Sys$UI$Silverlight$_ImageList$get_active() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._active;
}
function Sys$UI$Silverlight$_ImageList$set_active(value) {
if (value !== this.get_active()) {
this._active = value;
this.get_element().visibility = value ? 0 : 1;
if (this._toggle) {
this._toggle.set_visible(value);
}
if (!value) {
this.set_visible(false);
}
}
}
function Sys$UI$Silverlight$_ImageList$get_canActivate() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._canActivate;
}
function Sys$UI$Silverlight$_ImageList$set_canActivate(value) {
if (value !== this.get_canActivate()) {
this._canActivate = value;
this._ensureActivation();
}
}
function Sys$UI$Silverlight$_ImageList$get_items() {
if (arguments.length !== 0) throw Error.parameterCount();
return this._virtualItems;
}
function Sys$UI$Silverlight$_ImageList$set_items(value) {
this._virtualItems = value || [];
this._imageItems = [];
if (value) {
for (var i = 0, l = value.length; i < l; i++) {
if (value[i].get_thumbnailSource()) {
this._imageItems[this._imageItems.length] = i;
}
}
}
this._ensureActivation();
}
function Sys$UI$Silverlight$_ImageList$set_visible(value) {
Sys.UI.Silverlight._ImageList.callBaseMethod(this, "set_visible", [value]);
this.get_element().IsHitTestVisible = value;
}
function Sys$UI$Silverlight$_ImageList$_assignImages() {
for (var i = 0, l = this._items.length; i < l; i++) {
var item = this._items[i];
var offset = this._scrollOffset + i;
if (offset < this._imageItems.length) {
var e = item.image.get_element();
var vitem = this._virtualItems[this._imageItems[offset]];
e.source = null;
e.source = vitem.get_thumbnailSource();
item.button.set_visible(true);
item.button._imageIndex = offset;
if (item.title) {
item.title.set_text(vitem.get_title());
}
}
else {
item.button.set_visible(false);
item.button._imageIndex = null;
}
}
}
function Sys$UI$Silverlight$_ImageList$_bindAutoAnimations(element, name) {
Sys.UI.Silverlight._ImageList.callBaseMethod(this, "_bindAutoAnimations", [element, name]);
var sb = element.findName(name + "_ScrollAnimationStoryboard");
var anim = element.findName(name + "_ScrollAnimation");
if (sb && anim) {
this._scrollStoryboard = sb;
this._scrollAnimation = anim;
var interval = anim.duration.seconds * 1000;
var next = element.findName(name + "_ScrollNext");
var prev = element.findName(name + "_ScrollPrevious");
if (next && prev) {
this._next = new Sys.UI.Silverlight._Button(next, true, interval, this._scrollNext, null, this);
this._previous = new Sys.UI.Silverlight._Button(prev, true, interval, this._scrollPrevious, null, this);
}
}
this._bindItems(element, name);
}
function Sys$UI$Silverlight$_ImageList$_bindItems(e, name) {
this._items = [];
var item, image, text;
for (var i = 1;
item = e.findName(name + "_ScrollItem" + i),
image = e.findName(name + "_ScrollItem" + i + "_Image"),
title = e.findName(name + "_ScrollItem" + i + "_Title"),
item && image; i++) {
this._items[i-1] = {
button: new Sys.UI.Silverlight._Button(item, true, 0, this._itemClick, null, this),
image: new Sys.UI.Silverlight._DomElement(image, true),
title: (title ? new Sys.UI.Silverlight._TextBlock(title, null, true) : null)
};
}
if (this._items.length > 0) {
var first = this._items[0].button.get_element();
this._itemSize = first.width;
this._itemSpacing = first["Canvas.Left"] * 2;
}
}
function Sys$UI$Silverlight$_ImageList$dispose() {
if (this._next) {
this._next.dispose();
}
if (this._previous) {
this._previous.dispose();
}
if (this._toggle) {
this._toggle.dispose();
}
for (var i = 0, l = this._items.length; i < l; i++) {
var item = this._items[i];
item.button.dispose();
item.image.dispose();
if (item.title) {
item.title.dispose();
}
}
this._virtualItems = null;
this._imageItems = null;
this._scrollAnimation = null;
this._scrollStoryboard = null;
Sys.UI.Silverlight._ImageList.callBaseMethod(this, "dispose");
}
function Sys$UI$Silverlight$_ImageList$_ensureActivation() {
if (this._imageItems.length === 0 || !this.get_canActivate()) {
this.set_active(false);
}
else {
this.set_active(true);
this._reset();
this._assignImages();
}
}
function Sys$UI$Silverlight$_ImageList$_handleOverflow(direction) {
var layoutIndex = direction === 1 ? (this._items.length-1) : -1;
var imageIndex = this._scrollOffset + layoutIndex;
var item = this._items[this._overflowIndex];
var e = item.image.get_element();
var vitem = this._virtualItems[this._imageItems[imageIndex]];
e.source = null;
e.source = vitem.get_thumbnailSource();
item.button._imageIndex = imageIndex;
if (item.title) {
item.title.set_text(vitem.get_title());
}
var button = item.button.get_element();
button["Canvas.Left"] = imageIndex * (this._itemSize + this._itemSpacing) + (this._itemSpacing / 2);
this._overflowIndex += direction;
if (this._overflowIndex < 0) {
this._overflowIndex = this._items.length - 1;
}
else if (this._overflowIndex >= this._items.length) {
this._overflowIndex = 0;
}
}
function Sys$UI$Silverlight$_ImageList$_itemClick(button) {
var index = button._imageIndex;
if (index !== null) {
this._itemClickDelegate(this._imageItems[index]);
}
}
function Sys$UI$Silverlight$_ImageList$_onToggle() {
this.set_visible(!this.get_visible());
}
function Sys$UI$Silverlight$_ImageList$_reset() {
var oldOffset = this._scrollOffset;
this._scrollOffset = 0;
for (var i = 0, l = this._items.length; i < l; i++) {
var button = this._items[i].button;
button._imageIndex = i;
button.get_element()["Canvas.Left"] = i * (this._itemSize + this._itemSpacing) + (this._itemSpacing/2);
}
this._overflowIndex = this._items.length - 1;
if (this._scrollAnimation && (oldOffset !== 0)) {
this._scrollAnimation.To = "0";
this._scrollStoryboard.begin();
}
}
function Sys$UI$Silverlight$_ImageList$_scroll(direction) {
if (this._scrollAnimation) {
this._handleOverflow(direction);
var fromOffset = this._scrollOffset;
this._scrollOffset += direction;
this._scrollAnimation.From = "-" + (fromOffset * (this._itemSize + this._itemSpacing));
this._scrollAnimation.To = "-" + (this._scrollOffset * (this._itemSize + this._itemSpacing));
this._scrollStoryboard.begin();
}
else {
this._scrollOffset += direction;
this._assignImages();
}
}
function Sys$UI$Silverlight$_ImageList$_scrollNext() {
if (this._scrollOffset < (this._imageItems.length - this._items.length + 1)) {
this._scroll(1);
}
}
function Sys$UI$Silverlight$_ImageList$_scrollPrevious() {
if (this._scrollOffset > 0) {
this._scroll(-1);
}
}
Sys.UI.Silverlight._ImageList.prototype = {
_next: null,
_previous: null,
_scrollAnimation: null,
_scrollStoryboard: null,
_itemSize: 0,
_itemSpacing: 0,
_canActivate: true,
_active: false,
_scrollOffset: 0,
_overflowIndex: 0,
get_active: Sys$UI$Silverlight$_ImageList$get_active,
set_active: Sys$UI$Silverlight$_ImageList$set_active,
get_canActivate: Sys$UI$Silverlight$_ImageList$get_canActivate,
set_canActivate: Sys$UI$Silverlight$_ImageList$set_canActivate,
get_items: Sys$UI$Silverlight$_ImageList$get_items,
set_items: Sys$UI$Silverlight$_ImageList$set_items,
set_visible: Sys$UI$Silverlight$_ImageList$set_visible,
_assignImages: Sys$UI$Silverlight$_ImageList$_assignImages,
_bindAutoAnimations: Sys$UI$Silverlight$_ImageList$_bindAutoAnimations,
_bindItems: Sys$UI$Silverlight$_ImageList$_bindItems,
dispose: Sys$UI$Silverlight$_ImageList$dispose,
_ensureActivation: Sys$UI$Silverlight$_ImageList$_ensureActivation,
_handleOverflow: Sys$UI$Silverlight$_ImageList$_handleOverflow,
_itemClick: Sys$UI$Silverlight$_ImageList$_itemClick,
_onToggle: Sys$UI$Silverlight$_ImageList$_onToggle,
_reset: Sys$UI$Silverlight$_ImageList$_reset,
_scroll: Sys$UI$Silverlight$_ImageList$_scroll,
_scrollNext: Sys$UI$Silverlight$_ImageList$_scrollNext,
_scrollPrevious: Sys$UI$Silverlight$_ImageList$_scrollPrevious
}
Sys.UI.Silverlight._ImageList.registerClass('Sys.UI.Silverlight._ImageList', Sys.UI.Silverlight._DomElement);
Sys.UI.Silverlight.MarkerEventArgs = function Sys$UI$Silverlight$MarkerEventArgs(marker) {
///
///
var e = Function._validateParams(arguments, [
{name: "marker"}
]);
if (e) throw e;
this._marker = marker;
Sys.UI.Silverlight.MarkerEventArgs.initializeBase(this);
}
function Sys$UI$Silverlight$MarkerEventArgs$get_marker() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._marker || null;
}
Sys.UI.Silverlight.MarkerEventArgs.prototype = {
get_marker: Sys$UI$Silverlight$MarkerEventArgs$get_marker
}
Sys.UI.Silverlight.MarkerEventArgs.registerClass("Sys.UI.Silverlight.MarkerEventArgs", Sys.EventArgs);
Sys.UI.Silverlight.MediaChapterEventArgs = function Sys$UI$Silverlight$MediaChapterEventArgs(chapter) {
///
///
var e = Function._validateParams(arguments, [
{name: "chapter", type: Sys.UI.Silverlight.MediaChapter, mayBeNull: true}
]);
if (e) throw e;
this._chapter = chapter;
Sys.UI.Silverlight.MediaChapterEventArgs.initializeBase(this);
}
function Sys$UI$Silverlight$MediaChapterEventArgs$get_chapter() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._chapter || null;
}
Sys.UI.Silverlight.MediaChapterEventArgs.prototype = {
get_chapter: Sys$UI$Silverlight$MediaChapterEventArgs$get_chapter
}
Sys.UI.Silverlight.MediaChapterEventArgs.registerClass("Sys.UI.Silverlight.MediaChapterEventArgs", Sys.CancelEventArgs);
Sys.UI.Silverlight.MediaChapter = function Sys$UI$Silverlight$MediaChapter(title, position, thumbnailSource) {
///
///
///
///
var e = Function._validateParams(arguments, [
{name: "title", type: String},
{name: "position", type: Number},
{name: "thumbnailSource", type: String}
]);
if (e) throw e;
if (position < 0) {
throw Error.argumentOutOfRange("position", position);
}
this._title = title;
this._position = position;
this._thumbnailSource = thumbnailSource;
Sys.UI.Silverlight.MediaChapter.initializeBase(this);
}
function Sys$UI$Silverlight$MediaChapter$get_position() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._position;
}
function Sys$UI$Silverlight$MediaChapter$get_thumbnailSource() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._thumbnailSource;
}
function Sys$UI$Silverlight$MediaChapter$get_title() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._title;
}
Sys.UI.Silverlight.MediaChapter.prototype = {
get_position: Sys$UI$Silverlight$MediaChapter$get_position,
get_thumbnailSource: Sys$UI$Silverlight$MediaChapter$get_thumbnailSource,
get_title: Sys$UI$Silverlight$MediaChapter$get_title
}
Sys.UI.Silverlight.MediaChapter._createChapters = function Sys$UI$Silverlight$MediaChapter$_createChapters() {
var list = [];
for (var i = 0, l = arguments.length; i < l; i += 3) {
if (i+2 >= arguments.length) {
throw Error.argument("arguments");
}
var title = arguments[i] || "";
var position = arguments[i+1];
var source = arguments[i+2] || "";
if (typeof(title) !== "string") {
throw Error.argumentType("title", typeof(title), String);
}
if (typeof(position) !== "number") {
throw Error.argumentType("position", typeof(number), Number);
}
if (typeof(source) !== "string") {
throw Error.argumentType("thumbnailImageSource", typeof(source), String);
}
list[list.length] = new Sys.UI.Silverlight.MediaChapter(arguments[i], arguments[i+1], arguments[i+2]);
}
return list;
}
Sys.UI.Silverlight.MediaChapter.registerClass("Sys.UI.Silverlight.MediaChapter");
Sys.UI.Silverlight.MediaPlayer = function Sys$UI$Silverlight$MediaPlayer(domElement) {
///
///
var e = Function._validateParams(arguments, [
{name: "domElement", domElement: true}
]);
if (e) throw e;
this._children = {};
this._timeline = [];
Sys.UI.Silverlight.MediaPlayer.initializeBase(this, [domElement]);
}
function Sys$UI$Silverlight$MediaPlayer$add_chapterSelected(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("chapterSelected", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_chapterSelected(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("chapterSelected", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_chapterStarted(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("chapterStarted", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_chapterStarted(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("chapterStarted", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_currentStateChanged(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("currentStateChanged", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_currentStateChanged(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("currentStateChanged", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_markerReached(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("markerReached", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_markerReached(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("markerReached", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_mediaEnded(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("mediaEnded", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_mediaEnded(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("mediaEnded", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_mediaFailed(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("mediaFailed", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_mediaFailed(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("mediaFailed", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_mediaOpened(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("mediaOpened", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_mediaOpened(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("mediaOpened", handler);
}
function Sys$UI$Silverlight$MediaPlayer$add_volumeChanged(handler) {
///
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().addHandler("volumeChanged", handler);
}
function Sys$UI$Silverlight$MediaPlayer$remove_volumeChanged(handler) {
var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
if (e) throw e;
this.get_events().removeHandler("volumeChanged", handler);
}
function Sys$UI$Silverlight$MediaPlayer$get_autoPlay() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._autoPlay;
}
function Sys$UI$Silverlight$MediaPlayer$set_autoPlay(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
if (e) throw e;
this._autoPlay = value;
if (this._me) {
this._me.autoPlay = value;
}
}
function Sys$UI$Silverlight$MediaPlayer$get_autoCue() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._autoCue;
}
function Sys$UI$Silverlight$MediaPlayer$set_autoCue(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
if (e) throw e;
this._autoCue = value;
if (this._me) {
this._ensureMedia();
}
}
function Sys$UI$Silverlight$MediaPlayer$get_caption() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._caption;
}
function Sys$UI$Silverlight$MediaPlayer$set_caption(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._caption = value;
this._ensureCaption();
}
function Sys$UI$Silverlight$MediaPlayer$get_chapters() {
///
if (arguments.length !== 0) throw Error.parameterCount();
if (this._chapters) {
return Array.clone(this._chapters);
}
return [];
}
function Sys$UI$Silverlight$MediaPlayer$set_chapters(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Array, mayBeNull: true, elementType: Sys.UI.Silverlight.MediaChapter}]);
if (e) throw e;
this._chapters = value;
this._setProperties("items", ["ChapterArea"], value);
this._timeline = [];
if (value) {
for (var i = 0, l = value.length; i < l; i++) {
this._timeline[this._timeline.length] = value[i].get_position();
}
}
this._ensureChapterStarted(true);
}
function Sys$UI$Silverlight$MediaPlayer$get_currentChapter() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._chapterStarted === -1 ? null : this.get_chapters()[this._chapterStarted];
}
function Sys$UI$Silverlight$MediaPlayer$set_currentChapter(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Silverlight.MediaChapter, mayBeNull: true}]);
if (e) throw e;
this._ensureLoaded();
var chapters = this.get_chapters();
if (!value) {
throw Error.argumentNull("value");
}
var found = false;
for (var i = 0, l = chapters.length; i < l; i++) {
if (chapters[i] === value) {
found = true;
break;
}
}
if (!found) {
throw Error.argument("value", Sys.UI.Silverlight.MediaRes.invalidChapter);
}
this.set_position(value.get_position());
this._ensureChapterStarted(false);
}
function Sys$UI$Silverlight$MediaPlayer$get_currentState() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._me ? this._me.currentState : null;
}
function Sys$UI$Silverlight$MediaPlayer$get_enableCaptions() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._enableCaptions;
}
function Sys$UI$Silverlight$MediaPlayer$set_enableCaptions(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
if (e) throw e;
if (value !== this.get_enableCaptions()) {
this._enableCaptions = value;
this._ensureCaption();
}
}
function Sys$UI$Silverlight$MediaPlayer$get_mediaElement() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._me;
}
function Sys$UI$Silverlight$MediaPlayer$get_mediaSource() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._mediaSource;
}
function Sys$UI$Silverlight$MediaPlayer$set_mediaSource(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._mediaSource = value;
this._forcePlay = false;
if (this._me) {
this._loadPlaceholderImage();
this._me.source = this.get_autoCue() ? value : null;
if (!this.get_autoCue()) {
this._ensureMedia();
}
}
}
function Sys$UI$Silverlight$MediaPlayer$get_muted() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._muted;
}
function Sys$UI$Silverlight$MediaPlayer$set_muted(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]);
if (e) throw e;
if (value !== this.get_muted()) {
this._muted = value;
if (this._me) {
this._me.isMuted = value;
this._setProperties("state", ["MuteButton"], value ? 1 : 0);
}
}
}
function Sys$UI$Silverlight$MediaPlayer$get_placeholderImageSource() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._phImageSource;
}
function Sys$UI$Silverlight$MediaPlayer$set_placeholderImageSource(value) {
var e = Function._validateParams(arguments, [{name: "value", type: String}]);
if (e) throw e;
this._phImageSource = value;
}
function Sys$UI$Silverlight$MediaPlayer$get_position() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._me ? this._me.position.seconds : 0;
}
function Sys$UI$Silverlight$MediaPlayer$set_position(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
if (e) throw e;
if (isNaN(value) || !isFinite(value)) {
throw Error.argumentOutOfRange("value", value);
}
this._ensureLoaded();
if (!this._canSeek) return;
this._mediaEnded = false;
this.set_caption("");
value = Math.min(this._duration, Math.max(0, value));
var position = this._me.position;
position.seconds = value;
this._me.position = position;
this._ensurePosition(value);
}
function Sys$UI$Silverlight$MediaPlayer$get_volume() {
///
if (arguments.length !== 0) throw Error.parameterCount();
return this._volume;
}
function Sys$UI$Silverlight$MediaPlayer$set_volume(value) {
var e = Function._validateParams(arguments, [{name: "value", type: Number}]);
if (e) throw e;
if (value < 0 || value > 1) {
throw Error.argumentOutOfRange("value", value, Sys.UI.Silverlight.MediaRes.volumeRange);
}
if (value !== this.get_volume()) {
this._volume = value;
if (this._me && this._me.currentState !== "Closed") {
this._me.volume = value;
}
}
this._setProperties("value", ["VolumeSlider"], value);
}
function Sys$UI$Silverlight$MediaPlayer$_bindAllControls() {
var c = this.get_element().content.root;
this._bindElements(c,
[ [ 0,
["FullScreenVideoWindow", false],
["BufferingArea", false],
["PlayerControls", true],
["PlaceholderImage", false]
],
[ 1,
["VideoWindow", true, 0, this._onTogglePlayPause, this._meDoubleClick, this],
["FullScreenArea", false, 0, this._onTogglePlayPause, this._meDoubleClick, this],
["PlayButton", true, 0, this._onPlay, null, this],
["StartButton", false, 0, this._onPlay, null, this],
["PlayPauseButton", true, 0, this._onTogglePlayPause, null, this, ["PlaySymbol", "PauseSymbol"]],
["StopButton", true, 0, this._onStop, null, this],
["PauseButton", true, 0, this._onPause, null, this],
["MuteButton", true, 0, this._onMute, null, this, ["MuteOffSymbol", "MuteOnSymbol"]],
["FullScreenButton", true, 0, this._onToggleFullScreen, null, this],
["NextButton", true, 0, this._onNext, null, this],
["PreviousButton", true, 0, this._onPrevious, null, this],
["VolumeUpButton", true, 20, this._onVolumeUp, null, this],
["VolumeDownButton", true, 20, this._onVolumeDown, null, this],
["CaptionToggleButton", false, 0, this._onCaptionToggle, null, this, ["CaptionOnSymbol", "CaptionOffSymbol"]]
],
[ 2,
["TotalTimeText", null, true],
["CurrentTimeText", null, true],
["CaptionText", c.findName("CaptionArea"), false],
["BufferingText", null, false],
["FullScreenCaptionText", c.findName("FullScreenCaptionArea"), false]
],
[ 3,
["TimeSlider", "TimeThumb", true, this._onTimeChanged, this],
["VolumeSlider", "VolumeThumb", true, this._onVolumeChanged, this]
],
[ 4,
["ChapterArea", c.findName("ChapterToggleButton"), false, this._onChapterClick, this]
],
[ 5,
["DownloadProgressSlider", c.findName("DownloadProgressText"), true]
]]);
this._bufferingStoryboard = c.findName("BufferingArea_Buffering");
var me = this._children["VideoWindow"];
if (!me) {
throw Error.invalidOperation(Sys.UI.Silverlight.MediaRes.noMediaElement);
}
this._me = me.get_element();
me.bindEvent("mediaOpened", null, this._meOpened, this);
me.bindEvent("mediaFailed", null, this._meFailed, this);
me.bindEvent("mediaEnded", null, this._meEnded, this);
me.bindEvent("downloadProgressChanged", null, this._meDownloadProgress, this);
me.bindEvent("bufferingProgressChanged", null, this._meBufferingProgress, this);
me.bindEvent("markerReached", null, this._meMarker, this);
me.bindEvent("currentStateChanged", null, this._meState, this);
}
function Sys$UI$Silverlight$MediaPlayer$_bindElements(c, list) {
for (var i = 0, l = list.length; i < l; i++) {
var typeList = list[i];
var typeCode = typeList[0];
for (var j = 1, jl = typeList.length; j < jl; j++) {
var e = typeList[j];
var name = e[0];
var el = c.findName(name);
if (!el) continue;
var type;
switch (typeCode) {
case 0: type = "_DomElement"; break;
case 1: type = "_Button"; break;
case 2: type = "_TextBlock"; break;
case 3: type = "_Slider"; break;
case 4: type = "_ImageList"; break;
case 5: type = "_ProgressBar"; break;
default: Sys.Debug.fail("Unknown type code " + typeCode);
}
type = Sys.UI.Silverlight[type];
Sys.Debug.assert(e.length <= 7, "bindElements only supports up to 7 constructor parameters.");
this._children[name] = new type(el, e[1], e[2], e[3], e[4], e[5], e[6]);
}
}
}
function Sys$UI$Silverlight$MediaPlayer$_detectChapterChange(position) {
if (this._timeline.length === 0) return;
var startTime = (this._chapterStarted === -1) ? -Infinity : this._timeline[this._chapterStarted];
var endTime = (this._chapterStarted + 1 >= this._timeline.length) ? Infinity : this._timeline[this._chapterStarted + 1];
if ((position < startTime) || (position > endTime)) {
this._ensureChapterStarted(false, position);
}
}
function Sys$UI$Silverlight$MediaPlayer$_enableBuffering(percent) {
var enabled = (percent !== null) && (percent < 100);
if (enabled) {
this._setProperties("text", ["BufferingText"], Math.floor(percent).toString());
}
this._setProperties("visible", ["BufferingText", "BufferingArea"], enabled);
var bs = this._bufferingStoryboard;
if (!bs) return;
if (!enabled) {
bs.stop();
this._bufferPlaying = false;
}
else if (!this._bufferPlaying) {
bs.begin();
this._bufferPlaying = true;
}
}
function Sys$UI$Silverlight$MediaPlayer$_ensureCaption() {
var showCaptions = this._toggledCaptions && this.get_enableCaptions();
var caption = showCaptions ? this.get_caption() : "";
this._setProperties("text", ["CaptionText", "FullScreenCaptionText"], caption);
if (caption) {
this._setProperties("visible", ["CaptionToggleButton"], true);
}
}
function Sys$UI$Silverlight$MediaPlayer$_ensureChapterStarted(force, position) {
if (!this._me) return;
if (!position) {
position = this.get_position();
}
var c = this._canSeek ? this._getChapterAt(position) : -1;
if ((force && (c !== -1 || c !== this._chapterStarted)) ||
(c !== this._chapterStarted)) {
this._raiseChapterStarted(c);
}
}
function Sys$UI$Silverlight$MediaPlayer$_ensureLoaded() {
if (!this._loaded) {
throw Error.invalidOperation(Sys.UI.Silverlight.MediaRes.pluginNotLoaded);
}
}
function Sys$UI$Silverlight$MediaPlayer$_ensureMedia() {
var available = this._mediaAvailable;
var hasDuration = (this._duration > 0);
var canSeek = hasDuration && this._canSeek;
var autoCue = this.get_autoCue();
var hasSource = !!this.get_mediaSource();
var playAsStart = !this._children["StartButton"] && !autoCue && hasSource;
this._setProperties("canActivate", ["ChapterArea"], canSeek);
this._setProperties("readOnly", ["TimeSlider"], !canSeek);
this._setProperties("visible", ["TotalTimeText", "CurrentTimeText", "TimeSlider"], hasDuration);
this._setProperties("enabled", ["PreviousButton", "NextButton"], canSeek);
this._setProperties("enabled", ["PauseButton", "StopButton"], available);
this._setProperties("enabled", ["PlayPauseButton", "PlayButton"], available || playAsStart);
var sb = this._children["StartButton"];
if (sb) {
var showSB = !available && !autoCue && hasSource;
sb.set_visible(showSB);
sb.get_element().IsHitTestVisible = showSB;
}
if (hasDuration) {
this._setProperties("text", ["TotalTimeText"], this._formatTime(this._duration));
}
}
function Sys$UI$Silverlight$MediaPlayer$_ensurePosition(seconds) {
if (this._duration && !this.get_element().content.FullScreen) {
seconds = seconds || this.get_position();
this._setProperties("text", ["CurrentTimeText"], this._formatTime(seconds));
this._setProperties("value", ["TimeSlider"], seconds / this._duration);
}
}
function Sys$UI$Silverlight$MediaPlayer$_formatTime(time) {
var hours = Math.floor(time / 60 / 60);
var minutes = Math.floor(time / 60) - (hours * 60);
var seconds = Math.floor(time) - (minutes * 60) - (hours * 60 * 60);
var s = "";
if (hours) {
hours = "0" + hours;
s = hours.substr(hours.length-2, 2) + ":";
}
minutes = "0" + minutes;
s += minutes.substr(minutes.length-2, 2) + ":";
seconds = "0" + seconds;
s += seconds.substr(seconds.length-2, 2);
return s;
}
function Sys$UI$Silverlight$MediaPlayer$_getChapterAt(position) {
for (var i = 0, l = this._timeline.length; i <= l; i++) {
if (i === this._timeline.length || ((this._timeline[i] - 0.001) > position)) return i-1;
}
}
function Sys$UI$Silverlight$MediaPlayer$_loadPlaceholderImage() {
var source = this.get_placeholderImageSource();
var ph = this._children["PlaceholderImage"];
if (ph && source) {
ph.get_element().source = source;
ph.set_visible(true);
}
}
function Sys$UI$Silverlight$MediaPlayer$_meBufferingProgress() {
if (!this._me) return;
var percent = Math.round(this._me.bufferingProgress * 100);
this._enableBuffering(percent);
}
function Sys$UI$Silverlight$MediaPlayer$_mediaQueued() {
return !this.get_autoCue() && !this._me.source && this.get_mediaSource();
}
function Sys$UI$Silverlight$MediaPlayer$_meDoubleClick() {
if (!this._me) return;
this._onTogglePlayPause();
this._onToggleFullScreen();
}
function Sys$UI$Silverlight$MediaPlayer$_meDownloadProgress() {
if (!this._me) return;
this._enableBuffering(null);
this._setProperties("value", ["DownloadProgressSlider"], this._me.downloadProgress);
}
function Sys$UI$Silverlight$MediaPlayer$_meMarker(sender, args) {
if (!this._me) return;
var marker = args.marker;
if (this._toggledCaptions && this.get_enableCaptions()) {
var type = marker.type ? marker.type.toLowerCase() : "";
if (type === "caption") {
var text = marker.text ? marker.text : "";
if (text.trim().length === 0) {
text = "";
}
this.set_caption(text);
this.raisePropertyChanged("caption");
}
}
var eventArgs = new Sys.UI.Silverlight.MarkerEventArgs(marker);
this.onMarkerReached(eventArgs);
this._raiseEvent("markerReached", eventArgs);
}
function Sys$UI$Silverlight$MediaPlayer$_meEnded() {
if (!this._me) return;
this._mediaEnded = true;
this._forcePlay = false;
this.onMediaEnded(Sys.EventArgs.Empty);
this._raiseEvent("mediaEnded");
}
function Sys$UI$Silverlight$MediaPlayer$_meFailed() {
if (!this._me) return;
this._mediaAvailable = false;
this._mediaEnded = false;
this._canSeek = false;
this._forcePlay = false;
this._duration = 0;
this._ensureMedia();
this._enableBuffering(null);
this.set_caption("");
this.onMediaFailed(Sys.EventArgs.Empty);
this._raiseEvent("mediaFailed");
}
function Sys$UI$Silverlight$MediaPlayer$_meOpened() {
if (!this._me) return;
this._mediaEnded = false;
this._mediaAvailable = true;
this._canSeek = this._me.canSeek;
this._duration = this._me.naturalDuration.seconds;
this._me.volume = this.get_volume();
this._setProperties("visible", ["PlaceholderImage"], false);
this.set_caption("");
this._ensurePosition();
this._ensureMedia();
if (!this._timerCookie) {
this._tickTimerDelegate = Function.createDelegate(this, this._tickTimer);
this._timerCookie = window.setTimeout(this._tickTimerDelegate, 200);
}
this.onMediaOpened(Sys.EventArgs.Empty);
this._raiseEvent("mediaOpened");
if (this._forcePlay) {
this._forcePlay = false;
this._me.play();
}
}
function Sys$UI$Silverlight$MediaPlayer$_meState() {
if (!this._me) return;
var state = this._me.currentState;
if (state === "Stopped" && this._forcePlayOnStop) {
this._forcePlayOnStop = false;
this._me.play();
}
if (state === this._oldState) return;
this._oldState = state;
if (state === "Closed") {
this._enableBuffering(null);
this._mediaAvailable = false;
this._canSeek = false;
this._forcePlay = false;
this._duration = 0;
this._mediaEnded = false;
this._ensureMedia();
this.set_caption("");
}
else if (state === "Playing" || state === "Paused") {
this._enableBuffering(null);
}
this._setProperties("state", ["PlayPauseButton"], state === "Playing" ? 1 : 0);
this.onCurrentStateChanged(Sys.EventArgs.Empty);
this._raiseEvent("currentStateChanged");
}
function Sys$UI$Silverlight$MediaPlayer$_onCaptionToggle() {
this._toggledCaptions = !this._toggledCaptions;
this._ensureCaption();
this._setProperties("state", ["CaptionToggleButton"], this._toggledCaptions ? 0 : 1);
}
function Sys$UI$Silverlight$MediaPlayer$_onChapterClick(index) {
var chapters = this.get_chapters();
if (index < chapters.length) {
var chapter = chapters[index];
var args = new Sys.UI.Silverlight.MediaChapterEventArgs(chapter);
this.onChapterSelected(args);
this._raiseEvent("chapterSelected", args);
if (!args.get_cancel()) {
this.set_currentChapter(chapter);
}
}
}
function Sys$UI$Silverlight$MediaPlayer$onChapterSelected(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.Silverlight.MediaChapterEventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$onChapterStarted(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.Silverlight.MediaChapterEventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$onCurrentStateChanged(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.EventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$onMarkerReached(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.Silverlight.MarkerEventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$onMediaEnded(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.EventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$onMediaFailed(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.EventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$onMediaOpened(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.UI.EventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$_onMute() {
this.set_muted(!this.get_muted());
this.onVolumeChanged(Sys.EventArgs.Empty);
this._raiseEvent("volumeChanged");
}
function Sys$UI$Silverlight$MediaPlayer$_onNext() {
var chapters = this.get_chapters();
if (!chapters || !chapters.length) {
this._skipTime(1);
}
else {
var next = this._chapterStarted + 1;
if (next < chapters.length) {
var chapter = chapters[next];
var args = new Sys.UI.Silverlight.MediaChapterEventArgs(chapter);
this.onChapterSelected(args);
this._raiseEvent("chapterSelected", args);
if (!args.get_cancel()) {
this.set_currentChapter(chapter);
}
}
}
}
function Sys$UI$Silverlight$MediaPlayer$_onPause() {
this.pause();
}
function Sys$UI$Silverlight$MediaPlayer$_onPlay() {
this.play();
}
function Sys$UI$Silverlight$MediaPlayer$onPluginFullScreenChanged(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.EventArgs}
]);
if (e) throw e;
var fs = this._children["FullScreenArea"];
if (!fs) return;
fs = fs.get_element();
var root = this.get_element().content.root;
if (this.get_element().content.FullScreen) {
fs.Visibility = 0;
var s = Sys.UI.Silverlight.Control._computeScale(root);
var newX = s.horizontal;
var newY = s.vertical;
this._originalScale = Sys.UI.Silverlight.Control._applyScale(root, newX, newY);
var fsVideoWindow = this._children["FullScreenVideoWindow"];
if (fsVideoWindow) {
fsVideoWindow = fsVideoWindow.get_element();
var scale = Math.min(s.horizontal, s.vertical);
var offX = (fs.getHost().content.ActualWidth-fsVideoWindow.width*scale)/2;
var offY = (fs.getHost().content.ActualHeight-fsVideoWindow.height*scale)/2;
Sys.UI.Silverlight.MediaPlayer._applyMatrix(fsVideoWindow,
Math.min(newY/newX, 1),
Math.min(newX/newY, 1),
offX/newX, offY/newY);
}
}
else {
Sys.UI.Silverlight.Control._applyScale(root, this._originalScale.x, this._originalScale.y);
fs.Visibility = 1;
this._ensurePosition();
}
}
function Sys$UI$Silverlight$MediaPlayer$onPluginLoaded() {
this._bindAllControls();
var me = this._me;
this._loadPlaceholderImage();
me.autoPlay = this.get_autoPlay();
me.isMuted = this.get_muted();
this._setProperties("state", ["MuteButton"], this.get_muted() ? 1 : 0);
me.volume = this.get_volume();
this._setProperties("value", ["VolumeSlider"], this.get_volume());
this._setProperties("items", ["ChapterArea"], this.get_chapters());
this._ensureCaption();
if (this.get_mediaSource() && this.get_autoCue()) {
me.source = this.get_mediaSource();
}
else {
this._ensureMedia();
}
}
function Sys$UI$Silverlight$MediaPlayer$_onPrevious() {
var chapters = this.get_chapters();
if (!chapters || !chapters.length) {
this._skipTime(-1);
}
else {
var newChapter = -1;
if (this._chapterStarted >= 0) {
var startTime = this._timeline[this._chapterStarted];
var position = this.get_position();
if ((position - startTime) > 1) {
newChapter = this._chapterStarted;
}
else {
newChapter = this._chapterStarted-1;
}
}
var chapter = (newChapter === -1) ? null : chapters[newChapter];
var args = new Sys.UI.Silverlight.MediaChapterEventArgs(chapter);
this.onChapterSelected(args);
this._raiseEvent("chapterSelected", args);
if (!args.get_cancel()) {
if (chapter) {
this.set_currentChapter(chapter);
}
else {
this.set_position(0);
}
}
}
}
function Sys$UI$Silverlight$MediaPlayer$_onStop() {
this.stop();
}
function Sys$UI$Silverlight$MediaPlayer$_onToggleFullScreen() {
var c = this.get_element().content;
c.FullScreen = !c.FullScreen;
}
function Sys$UI$Silverlight$MediaPlayer$_onTogglePlayPause() {
this.get_currentState() === "Playing" ? this.pause() : this.play();
}
function Sys$UI$Silverlight$MediaPlayer$_onTimeChanged(slider) {
this.set_position(slider.get_value() * this._duration);
}
function Sys$UI$Silverlight$MediaPlayer$onVolumeChanged(args) {
///
///
var e = Function._validateParams(arguments, [
{name: "args", type: Sys.EventArgs}
]);
if (e) throw e;
}
function Sys$UI$Silverlight$MediaPlayer$_onVolumeChanged(slider) {
this.set_volume(slider.get_value());
this.onVolumeChanged(Sys.EventArgs.Empty);
this._raiseEvent("volumeChanged");
}
function Sys$UI$Silverlight$MediaPlayer$_onVolumeDown() {
this.set_volume(Math.max(0, this.get_volume() - 0.02));
this.onVolumeChanged(Sys.EventArgs.Empty);
this._raiseEvent("volumeChanged");
}
function Sys$UI$Silverlight$MediaPlayer$_onVolumeUp() {
this.set_volume(Math.min(1, this.get_volume() + 0.02));
this.onVolumeChanged(Sys.EventArgs.Empty);
this._raiseEvent("volumeChanged");
}
function Sys$UI$Silverlight$MediaPlayer$pause() {
///
if (arguments.length !== 0) throw Error.parameterCount();
this._ensureLoaded();
this._me.pause();
}
function Sys$UI$Silverlight$MediaPlayer$play() {
///
if (arguments.length !== 0) throw Error.parameterCount();
this._ensureLoaded();
if (this._mediaQueued()) {
this._forcePlay = true;
this._me.source = this.get_mediaSource();
var sb = this._children["StartButton"];
if (sb) {
sb.set_visible(false);
sb.get_element().IsHitTestVisible = false;
}
}
else {
if (this._mediaEnded) {
this._mediaEnded = false;
this.set_caption("");
this._forcePlayOnStop = true;
this._me.stop();
}
else {
this._me.play();
}
}
}
function Sys$UI$Silverlight$MediaPlayer$pluginDispose() {
if (this._timerCookie) {
window.clearTimeout(this._timerCookie);
this._timerCookie = null;
}
for (var child in this._children) {
this._children[child].dispose();
}
if (this._me) {
this._me.stop();
this._me = null;
}
if (this._bufferingStoryboard) {
this._bufferingStoryboard.stop();
this._bufferingStoryboard = null;
}
Sys.UI.Silverlight.MediaPlayer.callBaseMethod(this, "pluginDispose");
}
function Sys$UI$Silverlight$MediaPlayer$_raiseChapterStarted(index) {
this._chapterStarted = index;
var chapter = index === -1 ? null : this.get_chapters()[index];
var args = new Sys.UI.Silverlight.MediaChapterEventArgs(chapter);
this.onChapterStarted(args);
this._raiseEvent("chapterStarted", args);
}
function Sys$UI$Silverlight$MediaPlayer$_setProperties(name, children, value) {
for (var i = 0, l = children.length; i < l; i++) {
var c = this._children[children[i]];
if (c) {
c["set_" + name](value);
}
}
}
function Sys$UI$Silverlight$MediaPlayer$_skipTime(direction) {
var delta = Math.max(5, this._duration / 10);
delta = direction * delta;
var newTime = delta + this.get_position();
this.set_position(newTime);
}
function Sys$UI$Silverlight$MediaPlayer$stop() {
///
if (arguments.length !== 0) throw Error.parameterCount();
this._ensureLoaded();
this._me.stop();
this._ensurePosition();
this._mediaEnded = false;
this.set_caption("");
}
function Sys$UI$Silverlight$MediaPlayer$_tickTimer() {
this._timerCookie = window.setTimeout(this._tickTimerDelegate, 200);
var position = this.get_position();
this._detectChapterChange(position);
if (this._forceUpdate || (this.get_currentState() === "Playing")) {
this._forceUpdate = false;
this._ensurePosition(position);
}
}
Sys.UI.Silverlight.MediaPlayer.prototype = {
_autoPlay: false,
_autoCue: true,
_forcePlay: false,
_bufferPlaying: false,
_canSeek: false,
_caption: "",
_chapters: null,
_chapterStarted: -1,
_duration: 0,
_enableCaptions: true,
_me: null,
_mediaAvailable: false,
_mediaSource: "",
_muted: false,
_oldState: null,
_phImageSource: "",
_toggledCaptions: true,
_volume: 0.5,
_forcePlayOnStop: false,
add_chapterSelected: Sys$UI$Silverlight$MediaPlayer$add_chapterSelected,
remove_chapterSelected: Sys$UI$Silverlight$MediaPlayer$remove_chapterSelected,
add_chapterStarted: Sys$UI$Silverlight$MediaPlayer$add_chapterStarted,
remove_chapterStarted: Sys$UI$Silverlight$MediaPlayer$remove_chapterStarted,
add_currentStateChanged: Sys$UI$Silverlight$MediaPlayer$add_currentStateChanged,
remove_currentStateChanged: Sys$UI$Silverlight$MediaPlayer$remove_currentStateChanged,
add_markerReached: Sys$UI$Silverlight$MediaPlayer$add_markerReached,
remove_markerReached: Sys$UI$Silverlight$MediaPlayer$remove_markerReached,
add_mediaEnded: Sys$UI$Silverlight$MediaPlayer$add_mediaEnded,
remove_mediaEnded: Sys$UI$Silverlight$MediaPlayer$remove_mediaEnded,
add_mediaFailed: Sys$UI$Silverlight$MediaPlayer$add_mediaFailed,
remove_mediaFailed: Sys$UI$Silverlight$MediaPlayer$remove_mediaFailed,
add_mediaOpened: Sys$UI$Silverlight$MediaPlayer$add_mediaOpened,
remove_mediaOpened: Sys$UI$Silverlight$MediaPlayer$remove_mediaOpened,
add_volumeChanged: Sys$UI$Silverlight$MediaPlayer$add_volumeChanged,
remove_volumeChanged: Sys$UI$Silverlight$MediaPlayer$remove_volumeChanged,
get_autoPlay: Sys$UI$Silverlight$MediaPlayer$get_autoPlay,
set_autoPlay: Sys$UI$Silverlight$MediaPlayer$set_autoPlay,
get_autoCue: Sys$UI$Silverlight$MediaPlayer$get_autoCue,
set_autoCue: Sys$UI$Silverlight$MediaPlayer$set_autoCue,
get_caption: Sys$UI$Silverlight$MediaPlayer$get_caption,
set_caption: Sys$UI$Silverlight$MediaPlayer$set_caption,
get_chapters: Sys$UI$Silverlight$MediaPlayer$get_chapters,
set_chapters: Sys$UI$Silverlight$MediaPlayer$set_chapters,
get_currentChapter: Sys$UI$Silverlight$MediaPlayer$get_currentChapter,
set_currentChapter: Sys$UI$Silverlight$MediaPlayer$set_currentChapter,
get_currentState: Sys$UI$Silverlight$MediaPlayer$get_currentState,
get_enableCaptions: Sys$UI$Silverlight$MediaPlayer$get_enableCaptions,
set_enableCaptions: Sys$UI$Silverlight$MediaPlayer$set_enableCaptions,
get_mediaElement: Sys$UI$Silverlight$MediaPlayer$get_mediaElement,
get_mediaSource: Sys$UI$Silverlight$MediaPlayer$get_mediaSource,
set_mediaSource: Sys$UI$Silverlight$MediaPlayer$set_mediaSource,
get_muted: Sys$UI$Silverlight$MediaPlayer$get_muted,
set_muted: Sys$UI$Silverlight$MediaPlayer$set_muted,
get_placeholderImageSource: Sys$UI$Silverlight$MediaPlayer$get_placeholderImageSource,
set_placeholderImageSource: Sys$UI$Silverlight$MediaPlayer$set_placeholderImageSource,
get_position: Sys$UI$Silverlight$MediaPlayer$get_position,
set_position: Sys$UI$Silverlight$MediaPlayer$set_position,
get_volume: Sys$UI$Silverlight$MediaPlayer$get_volume,
set_volume: Sys$UI$Silverlight$MediaPlayer$set_volume,
_bindAllControls: Sys$UI$Silverlight$MediaPlayer$_bindAllControls,
_bindElements: Sys$UI$Silverlight$MediaPlayer$_bindElements,
_detectChapterChange: Sys$UI$Silverlight$MediaPlayer$_detectChapterChange,
_enableBuffering: Sys$UI$Silverlight$MediaPlayer$_enableBuffering,
_ensureCaption: Sys$UI$Silverlight$MediaPlayer$_ensureCaption,
_ensureChapterStarted: Sys$UI$Silverlight$MediaPlayer$_ensureChapterStarted,
_ensureLoaded: Sys$UI$Silverlight$MediaPlayer$_ensureLoaded,
_ensureMedia: Sys$UI$Silverlight$MediaPlayer$_ensureMedia,
_ensurePosition: Sys$UI$Silverlight$MediaPlayer$_ensurePosition,
_formatTime: Sys$UI$Silverlight$MediaPlayer$_formatTime,
_getChapterAt: Sys$UI$Silverlight$MediaPlayer$_getChapterAt,
_loadPlaceholderImage: Sys$UI$Silverlight$MediaPlayer$_loadPlaceholderImage,
_meBufferingProgress: Sys$UI$Silverlight$MediaPlayer$_meBufferingProgress,
_mediaQueued: Sys$UI$Silverlight$MediaPlayer$_mediaQueued,
_meDoubleClick: Sys$UI$Silverlight$MediaPlayer$_meDoubleClick,
_meDownloadProgress: Sys$UI$Silverlight$MediaPlayer$_meDownloadProgress,
_meMarker: Sys$UI$Silverlight$MediaPlayer$_meMarker,
_meEnded: Sys$UI$Silverlight$MediaPlayer$_meEnded,
_meFailed: Sys$UI$Silverlight$MediaPlayer$_meFailed,
_meOpened: Sys$UI$Silverlight$MediaPlayer$_meOpened,
_meState: Sys$UI$Silverlight$MediaPlayer$_meState,
_onCaptionToggle: Sys$UI$Silverlight$MediaPlayer$_onCaptionToggle,
_onChapterClick: Sys$UI$Silverlight$MediaPlayer$_onChapterClick,
onChapterSelected: Sys$UI$Silverlight$MediaPlayer$onChapterSelected,
onChapterStarted: Sys$UI$Silverlight$MediaPlayer$onChapterStarted,
onCurrentStateChanged: Sys$UI$Silverlight$MediaPlayer$onCurrentStateChanged,
onMarkerReached: Sys$UI$Silverlight$MediaPlayer$onMarkerReached,
onMediaEnded: Sys$UI$Silverlight$MediaPlayer$onMediaEnded,
onMediaFailed: Sys$UI$Silverlight$MediaPlayer$onMediaFailed,
onMediaOpened: Sys$UI$Silverlight$MediaPlayer$onMediaOpened,
_onMute: Sys$UI$Silverlight$MediaPlayer$_onMute,
_onNext: Sys$UI$Silverlight$MediaPlayer$_onNext,
_onPause: Sys$UI$Silverlight$MediaPlayer$_onPause,
_onPlay: Sys$UI$Silverlight$MediaPlayer$_onPlay,
onPluginFullScreenChanged: Sys$UI$Silverlight$MediaPlayer$onPluginFullScreenChanged,
onPluginLoaded: Sys$UI$Silverlight$MediaPlayer$onPluginLoaded,
_onPrevious: Sys$UI$Silverlight$MediaPlayer$_onPrevious,
_onStop: Sys$UI$Silverlight$MediaPlayer$_onStop,
_onToggleFullScreen: Sys$UI$Silverlight$MediaPlayer$_onToggleFullScreen,
_onTogglePlayPause: Sys$UI$Silverlight$MediaPlayer$_onTogglePlayPause,
_onTimeChanged: Sys$UI$Silverlight$MediaPlayer$_onTimeChanged,
onVolumeChanged: Sys$UI$Silverlight$MediaPlayer$onVolumeChanged,
_onVolumeChanged: Sys$UI$Silverlight$MediaPlayer$_onVolumeChanged,
_onVolumeDown: Sys$UI$Silverlight$MediaPlayer$_onVolumeDown,
_onVolumeUp: Sys$UI$Silverlight$MediaPlayer$_onVolumeUp,
pause: Sys$UI$Silverlight$MediaPlayer$pause,
play: Sys$UI$Silverlight$MediaPlayer$play,
pluginDispose: Sys$UI$Silverlight$MediaPlayer$pluginDispose,
_raiseChapterStarted: Sys$UI$Silverlight$MediaPlayer$_raiseChapterStarted,
_setProperties: Sys$UI$Silverlight$MediaPlayer$_setProperties,
_skipTime: Sys$UI$Silverlight$MediaPlayer$_skipTime,
stop: Sys$UI$Silverlight$MediaPlayer$stop,
_tickTimer: Sys$UI$Silverlight$MediaPlayer$_tickTimer
}
Sys.UI.Silverlight.MediaPlayer._applyMatrix = function Sys$UI$Silverlight$MediaPlayer$_applyMatrix(el, xScale, yScale, xOffset, yOffset) {
var transform = el.RenderTransform;
if (!transform) {
el.RenderTransform = transform = el.getHost().content.createFromXaml('');
}
else if (transform.toString() !== "MatrixTransform") {
return;
}
transform.Matrix.M11 = xScale;
transform.Matrix.M22 = yScale;
transform.Matrix.OffsetX = xOffset;
transform.Matrix.OffsetY = yOffset;
}
Sys.UI.Silverlight.MediaPlayer.registerClass('Sys.UI.Silverlight.MediaPlayer', Sys.UI.Silverlight.Control);