| author | veltr |
| Fri, 29 Jun 2012 16:22:52 +0200 | |
| branch | new-model |
| changeset 923 | b3ee7d1b472a |
| parent 919 | 972099304059 |
| child 924 | 64c2eaafe5e2 |
| permissions | -rw-r--r-- |
|
711
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
1 |
/* To wrap a player the develop should create a new class derived from |
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
2 |
the IriSP.PopcornReplacement.player and defining the correct functions */ |
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
3 |
|
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
4 |
/** jwplayer player wrapper */ |
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
5 |
IriSP.PopcornReplacement.jwplayer = function(container, options) { |
| 914 | 6 |
/* appel du parent pour initialiser les structures communes à tous les players */ |
7 |
IriSP.PopcornReplacement.player.call(this, container, options); |
|
|
711
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
8 |
|
| 914 | 9 |
this.media.duration = options.duration; /* optional */ |
10 |
|
|
| 919 | 11 |
var _player = jwplayer(this.container), |
12 |
_this = this; |
|
|
711
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
13 |
|
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
14 |
/* Définition des fonctions de l'API - */ |
| 914 | 15 |
this.playerFns = { |
| 919 | 16 |
play: function() { return _player.play(true); }, |
17 |
pause: function() { return _player.pause(true); }, |
|
| 914 | 18 |
getPosition: function() { return _player.getPosition(); }, |
19 |
seek: function(pos) { return _player.seek(pos); }, |
|
20 |
getMute: function() { return _player.getMute() }, |
|
21 |
setMute: function(p) { return _player.setMute(p); }, |
|
22 |
getVolume: function() { return _player.getVolume() / 100; }, |
|
23 |
setVolume: function(p) { return _player.setVolume(Math.floor(100*p)); } |
|
24 |
} |
|
|
711
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
25 |
|
| 919 | 26 |
options.events = { |
27 |
onReady: function() { |
|
28 |
_this.trigger("loadedmetadata"); |
|
29 |
}, |
|
30 |
onTime: function() { |
|
| 923 | 31 |
if (_this.media.paused && _player.getState() === "PLAYING") { |
32 |
_this.media.paused = false; |
|
33 |
_this.trigger("play"); |
|
34 |
} |
|
| 919 | 35 |
_this.trigger("timeupdate"); |
36 |
}, |
|
37 |
onPlay: function() { |
|
| 923 | 38 |
_this.media.paused = false; |
| 919 | 39 |
_this.trigger("play"); |
40 |
}, |
|
41 |
onPause: function() { |
|
| 923 | 42 |
_this.media.paused = true; |
| 919 | 43 |
_this.trigger("pause"); |
44 |
}, |
|
45 |
onSeek: function() { |
|
46 |
_this.trigger("seeked"); |
|
47 |
} |
|
48 |
}; |
|
|
711
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
49 |
|
| 914 | 50 |
_player.setup(options); |
|
711
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
51 |
}; |
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
52 |
|
|
323205a7bd39
separated jwplayer code from pop.js and put it into its own folder, players/.
hamidouk
parents:
diff
changeset
|
53 |
IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {}); |