|
123
|
1 |
/* init.js - initialization and configuration of Popcorn and the widgets |
|
|
2 |
exemple json configuration: |
|
|
3 |
|
|
|
4 |
var config = { |
|
|
5 |
gui:{ |
|
|
6 |
width:650, |
|
|
7 |
height:480, |
|
|
8 |
container:'LdtPlayer', |
|
|
9 |
css:'../../src/css/LdtPlayer.css', |
|
|
10 |
widgets: [ |
|
|
11 |
{type: IriSP.PlayerWidget, // please note that type refers directly to the constructor of the widget. |
|
|
12 |
metadata:{ |
|
|
13 |
format:'cinelab', |
|
|
14 |
src:'test.json', |
|
|
15 |
load:'json'} |
|
|
16 |
}, |
|
|
17 |
{type: IriSP.SegmentsWidget, |
|
|
18 |
metadata:{ |
|
|
19 |
format:'cinelab', |
|
|
20 |
src:'test.json', |
|
|
21 |
load:'json'} |
|
|
22 |
}, |
|
|
23 |
{type: IriSP.AnnotationsWidget, |
|
|
24 |
metadata:{ |
|
|
25 |
format:'cinelab', |
|
|
26 |
src:'test.json', |
|
|
27 |
load:'json'} |
|
|
28 |
}, |
|
|
29 |
] |
|
|
30 |
player:{ |
|
|
31 |
type:'jwplayer', // player type |
|
|
32 |
|
|
|
33 |
// the rest is player-dependent configuration options. |
|
|
34 |
file : "video/franceculture/franceculture_retourdudimanche20100620.flv", |
|
|
35 |
streamer: "rtmp://media.iri.centrepompidou.fr/ddc_player/", |
|
|
36 |
flashplayer : '../libs/player.swf', |
|
|
37 |
live: true, |
|
|
38 |
"controlbar.position" : "none", |
|
|
39 |
height: 300, |
|
|
40 |
width: 200, |
|
|
41 |
provider: "rtmp" |
|
|
42 |
} |
|
|
43 |
}; |
|
|
44 |
*/ |
|
|
45 |
|
|
|
46 |
IriSP.configurePopcorn = function (options) { |
|
|
47 |
var pop; |
|
|
48 |
|
|
|
49 |
switch(options.player.type) { |
|
|
50 |
/* |
|
|
51 |
todo : dynamically create the div/video tag which |
|
|
52 |
will contain the video. |
|
|
53 |
*/ |
|
|
54 |
case "html5": |
|
|
55 |
//pop = Popcorn( |
|
|
56 |
break; |
|
|
57 |
}; |
|
|
58 |
}; |
|
|
59 |
|
|
|
60 |
IriSP.configureWidgets = function (guiOptions) { |
|
|
61 |
|
|
|
62 |
var dt = new IriSP.DataLoader(); |
|
|
63 |
|
|
|
64 |
var params = {width: guiOptions.width, height: guiOptions.height, |
|
|
65 |
var lay = new LayoutManager(params); |
|
|
66 |
|
|
|
67 |
for (widget in widgets) { |
|
|
68 |
var container = lay.createDiv(); |
|
|
69 |
|
|
|
70 |
}; |
|
|
71 |
}; |
|
|
72 |
|
|
|
73 |
IriSP.initInstance = function ( config ) { |
|
|
74 |
if ( config === null ) { |
|
|
75 |
config = IriSP.configDefault; |
|
|
76 |
|
|
|
77 |
} else { |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
if (.config.player.params == null ) { |
|
|
81 |
config.player.params = IriSP.configDefault.player.params; |
|
|
82 |
} |
|
|
83 |
|
|
|
84 |
if ( config.player.flashvars == null ) { |
|
|
85 |
config.player.flashvars = IriSP.configDefault.player.flashvars; |
|
|
86 |
} |
|
|
87 |
|
|
|
88 |
if ( config.player.attributes == null ) { |
|
|
89 |
config.player.attributes = IriSP.configDefault.player.attributes; |
|
|
90 |
} |
|
|
91 |
} |
|
|
92 |
|
|
|
93 |
var metadataSrc = config.metadata.src; |
|
|
94 |
var guiContainer = config.gui.container; |
|
|
95 |
var guiMode = config.gui.mode; |
|
|
96 |
|
|
|
97 |
IriSP.loadLibs(IriSP.lib, IriSP.config.gui.css, function() { |
|
|
98 |
IriSP.createPlayerChrome(); |
|
|
99 |
/******* Load Metadata *******/ |
|
|
100 |
IriSP.getMetadata(); |
|
|
101 |
}); |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
}; |