Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / av / widget / Player.js

History | View | Annotate | Download (2.64 KB)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.av.widget.Player"]){
9
dojo._hasResource["dojox.av.widget.Player"]=true;
10
dojo.provide("dojox.av.widget.Player");
11
dojo.require("dijit._Widget");
12
dojo.require("dijit._Templated");
13
dojo.declare("dojox.av.widget.Player",[dijit._Widget,dijit._Templated],{playerWidth:"480px",widgetsInTemplate:true,templateString:dojo.cache("dojox.av.widget","resources/Player.html","<div class=\"playerContainer\">\n\t<div class=\"PlayerScreen\" dojoAttachPoint=\"playerScreen\"></div>\n\t<table class=\"Controls\">\n\t\t<tr>\n\t\t\t<td colspan=\"2\" dojoAttachPoint=\"progressContainer\"></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"PlayContainer\" dojoAttachPoint=\"playContainer\"></td>\n\t\t\t<td class=\"ControlsRight\">\n\t\t\t<table class=\"StatusContainer\">\n\t\t\t\t<tr dojoAttachPoint=\"statusContainer\">\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=\"3\" class=\"ControlsBottom\" dojoAttachPoint=\"controlsBottom\"></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t</table>\n</div>\n"),_fillContent:function(){
14
if(!this.items&&this.srcNodeRef){
15
this.items=[];
16
var _1=dojo.query("*",this.srcNodeRef);
17
dojo.forEach(_1,function(n){
18
this.items.push(n);
19
},this);
20
}
21
},postCreate:function(){
22
dojo.style(this.domNode,"width",this.playerWidth+(dojo.isString(this.playerWidth)?"":"px"));
23
if(dojo.isString(this.playerWidth)&&this.playerWidth.indexOf("%")){
24
dojo.connect(window,"resize",this,"onResize");
25
}
26
this.children=[];
27
var _2;
28
dojo.forEach(this.items,function(n,i){
29
n.id=dijit.getUniqueId("player_control");
30
switch(dojo.attr(n,"controlType")){
31
case "play":
32
this.playContainer.appendChild(n);
33
break;
34
case "volume":
35
this.controlsBottom.appendChild(n);
36
break;
37
case "status":
38
this.statusContainer.appendChild(n);
39
break;
40
case "progress":
41
case "slider":
42
this.progressContainer.appendChild(n);
43
break;
44
case "video":
45
this.mediaNode=n;
46
this.playerScreen.appendChild(n);
47
break;
48
default:
49
}
50
this.items[i]=n.id;
51
},this);
52
},startup:function(){
53
this.media=dijit.byId(this.mediaNode.id);
54
if(!dojo.isAIR){
55
dojo.style(this.media.domNode,"width","100%");
56
dojo.style(this.media.domNode,"height","100%");
57
}
58
dojo.forEach(this.items,function(id){
59
if(id!==this.mediaNode.id){
60
var _3=dijit.byId(id);
61
this.children.push(_3);
62
if(_3){
63
_3.setMedia(this.media,this);
64
}
65
}
66
},this);
67
},onResize:function(_4){
68
var _5=dojo.marginBox(this.domNode);
69
if(this.media&&this.media.onResize!==null){
70
this.media.onResize(_5);
71
}
72
dojo.forEach(this.children,function(_6){
73
if(_6.onResize){
74
_6.onResize(_5);
75
}
76
});
77
}});
78
}