--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/eventslist.txt Wed Sep 19 14:11:49 2012 +0900
@@ -0,0 +1,79 @@
+Event Name Published by Subscribed by
+
+========================================== ============================== ==============================
+
+Annotation.boundsChanged Annotation Slice
+
+Annotation.getBounds Segments Annotation
+
+Annotation.hide Annotation
+
+Annotation.maximize CreateAnnotation Annotation
+ = Tweet
+
+Annotation.minimize CreateAnnotation Annotation
+ = Tweet
+
+Annotation.show Annotation
+
+AnnotationsList.refresh CreateAnnotation AnnotationsList
+ = Tagger
+
+Arrow.release Segments Arrow
+
+Arrow.takeover Segments Arrow
+
+Arrow.updatePosition Annotation Arrow
+ = Segments
+ = Slider
+
+CreateAnnotation.toggle Controller CreateAnnotation
+
+createAnnotationWidget.addedAnnotation X AnnotationsList
+
+Mediafragment.setHashToAnnotation Polemic Mediafragment
+ = Renkan =
+ = Segments =
+
+Mediafragment.setHashToTime Slider X
+
+Player.MouseOver Controller Slider
+
+Player.MouseOut Controller Slider
+
+search Controller AnnotationsList
+ = = Polemic
+ = = Segments
+ = = Tagcloud
+
+search.closed Controller AnnotationsList
+ = = Polemic
+ = = Segments
+ = = Tagcloud
+
+search.cleared Controller AnnotationsList
+ = Renkan Polemic
+ = = Segments
+ = = Tagcloud
+
+search.matchFound AnnotationsList Controller
+ = Polemic =
+ = Segments =
+
+search.noMatchFound AnnotationsList Controller
+ = Polemic =
+ = Segments =
+
+search.open Controller
+
+search.triggeredSearch Annotation Controller
+ = Renkan =
+ = Tagcloud =
+
+Slice.boundsChanged Slice CreateAnnotation
+
+Slice.hide CreateAnnotation Slice
+
+Slice.show CreateAnnotation Slice
+
+Tweet.show Polemic
\ No newline at end of file
--- a/doc/integration.en.md Fri Sep 14 10:38:04 2012 +0900
+++ b/doc/integration.en.md Wed Sep 19 14:11:49 2012 +0900
@@ -51,7 +51,7 @@
IriSP.libFiles.locations.jQueryUI = "libs/jquery-ui-1.8.16.custom.min.js";
IriSP.libFiles.locations.jwPlayerSWF = "libs/jwplayer/player.swf";
-## Configuration of metadata source ##
+## Configuration of a metadata source ##
A metadata source is defined by its url and file type (which defines the *serializer* to use).
@@ -66,42 +66,21 @@
## Configuration of the video player ##
-The video player is configured through an object having the following properties:
-
-- **metadata**: Metadata source.
-- **type**: Video player type :
- - **"jwplayer"**: Uses flash-based jwPlayer, compatible with many video and audio formats, including MP3 audio, MP4 video and RTMP streams.
- - **"html5"**: Uses the Popcorn.js library to play HTML5 videos. Supported formats : OGG and WebM on Firefox and Chrome, H.264 on Internet Explorer, Safari and Chrome.
- - **"youtube"**: Uses Popcorn's Youtube plugin.
- - **"dailymotion"**
- - **"auto"**: Replaced by *Youtube* or *Dailymotion* for a video hosted on one of these platform, or *jwPlayer* in other cases.
-- **width** and **height** of the video player.
-- **video**: Video URL. Optional: If present, it overrides the video URL defined in the metadata source.
-- Player-specific options, such as **provider** or **streamer** for JwPlayer
-
-Example:
-
- var playerConfig = {
- metadata: metadataSource,
- type: "jwplayer",
- height: 350,
- width: 620,
- provider: "rtmp"
- };
+In this version, the video player is now a widget. This section is therefore obsolete
## User Interface Configuration ##
-L’interface se configure par un objet GUI, contenant les propriétés suivantes:
+The interface is configured with the following properties:
-- **container**: l’ID de l’élément HTML dans lequel le player sera instancié.
-- **width** et **height**: largeur et hauteur de l’interface (*height* est optionnel).
-- **default\_options**: des options de configuration communes à tous les widgets, par exemple, comme ci-dessous, une source de métadonnées communes.
-- **css**: l’URL du fichier CSS de base (LdtPlayer-core.css)
-- **widgets**: la liste des widgets, sous la forme [ { type: *Type du widget*, option_1: *Valeur de l’option 1* } ]. Pour les options des widgets, se référer au document *Architecture générale*
+- **container**: ID of the DOM element in which the metadataplayer will be instantiated.
+- **width** et **height**: width and height of the interface (*height* is optional).
+- **default\_options**: Configuration options that will be passed to all widgets. In the example below, all widgets will connect to the same metadata source.
+- **css**: The URL of the base CSS stylesheet (LdtPlayer-core.css)
+- **widgets**: A list of widgets, in the following format: [ { type: *Widget type*, option_1: *Option 1 value* } ]. For widget options, please refer to the *general architecture* document
Exemple:
- var guiConfig = {
+ var config = {
container : "Metadataplayer",
default_options: {
metadata: metadataSource
@@ -109,6 +88,9 @@
css : "metadataplayer/css/LdtPlayer-core.css",
widgets: [
{
+ type: "AutoPlayer"
+ },
+ {
type: "Slider"
},{
type: "Controller",
@@ -123,14 +105,10 @@
]
};
-## Instanciation du player ##
+## Player instanciation ##
-Le player s’instancie en créant un objet de type **IriSP.Metadataplayer**.
+The metadataplayer is instantiated by creating an object of class **IriSP.Metadataplayer**.
Exemple:
- var config = {
- player: playerConfig,
- gui: guiConfig
- };
- var monPlayer = new IriSP.Metadataplayer(config);
+ var myPlayer = new IriSP.Metadataplayer(config);
--- a/doc/integration.fr.md Fri Sep 14 10:38:04 2012 +0900
+++ b/doc/integration.fr.md Wed Sep 19 14:11:49 2012 +0900
@@ -63,32 +63,11 @@
## Configuration de la fenêtre vidéo ##
-Les options de configuration de la fenêtre vidéo sont:
-
-- **metadata**: La source de métadonnées utilisée, notamment pour obtenir l’URL de la vidéo.
-- **type**: Le type de player vidéo utilisé. Les players disponibles sont :
- - **"jwplayer"**: Utilise le player flash jwPlayer, compatible avec de nombreux formats vidéo et audio et les flux RTMP.
- - **"html5"**: Utilise la bibliothèque Popcorn et les vidéos HTML5. Formats supportés: OGG et WebM sur Firefox et Chrome, H.264 sur Internet Explorer et Safari.
- - **"youtube"**: Utilise le plugin Youtube de Popcorn pour afficher les vidéos Youtube.
- - **"dailymotion"**
- - **"auto"**: Remplacé par *Youtube* ou *Dailymotion* pour une vidéo sur l’un de ces sites et par JwPlayer sinon.
-- **width** et **height**: largeur et hauteur de la fenêtre vidéo.
-- **video**: URL de la vidéo. Si ce paramètre est présent, il écrase l’URL chargée dans les métadonnées
-- Paramètres spécifiques à chaque player, qui seront transférés tels quels, par exemple **provider** pour JwPlayer
-
-Exemple:
-
- var playerConfig = {
- metadata: metadataSource,
- type: "jwplayer",
- height: 350,
- width: 620,
- provider: "rtmp"
- };
+Dans cette version, la fenêtre vidéo est désormais un widget. Cette section est donc obsolète.
## Configuration de l’interface utilisateur ##
-L’interface se configure par un objet GUI, contenant les propriétés suivantes:
+L’interface se configure par un objet contenant les propriétés suivantes:
- **container**: l’ID de l’élément HTML dans lequel le player sera instancié.
- **width** et **height**: largeur et hauteur de l’interface (*height* est optionnel).
@@ -98,7 +77,7 @@
Exemple:
- var guiConfig = {
+ var config = {
container : "Metadataplayer",
default_options: {
metadata: metadataSource
@@ -106,6 +85,9 @@
css : "metadataplayer/css/LdtPlayer-core.css",
widgets: [
{
+ type: "AutoPlayer"
+ },
+ {
type: "Slider"
},{
type: "Controller",
@@ -122,12 +104,8 @@
## Instanciation du player ##
-Le player s’instancie en créant un objet de type **IriSP.Metadataplayer**.
+Le player s’instancie en créant un objet de classe **IriSP.Metadataplayer**.
Exemple:
- var config = {
- player: playerConfig,
- gui: guiConfig
- };
var monPlayer = new IriSP.Metadataplayer(config);
--- a/doc/widget-api.fr.md Fri Sep 14 10:38:04 2012 +0900
+++ b/doc/widget-api.fr.md Wed Sep 19 14:11:49 2012 +0900
@@ -68,15 +68,15 @@
### Propriétés accessibles par le widget ###
-#### Popcorn ####
+#### Media ####
-Les fonctions de gestion de la lecture vidéo sont accessibles par la propriété **popcorn** du Metadataplayer.
+Les fonctions de gestion de la lecture vidéo sont accessibles via les objets **media**.
Par exemple:
- this.player.popcorn.trigger("Evenement"); => déclenche un événement Popcorn de type "Evenement"
- this.player.popcorn.play(); => met le player en lecture
- this.player.popcorn.currentTime() => obtient le timecode courant, en secondes
+ this.media.trigger("Evenement"); => déclenche un événement Popcorn de type "Evenement"
+ this.media.play(); => met le player en lecture
+ this.media.currentTime() => obtient le timecode courant, en secondes
#### Source de métadonnées ####
@@ -119,13 +119,20 @@
this.$.click(this.functionWrapper("onClick")); => Appellera this.onClick() lors d’un click sur le widget
-#### bindPopcorn ####
+#### onMediaEvent ####
-Attache un événement *Popcorn* à une fonction, sur le même mode que *functionWrapper*
+Attache un événement *Media* ("play", "timeupdate", ...) à une fonction désignée
+- par son nom, quand celle-ci est une méthode du widget, ce qui permet de l’associer directement au widget, sur le même mode que *functionWrapper*
+- comme fonction anonyme
Par exemple:
- this.bindPopcorn("timeupdate","onTimeupdate"); => Appellera this.onTimeupdate() lorsque l’événement Popcorn "timeupdate" est déclenché.
+ this.onMediaEvent("timeupdate","onTimeupdate"); => Appellera this.onTimeupdate() lorsque l’événement media "timeupdate" est déclenché.
+ this.onMediaEvent("play", function() { console.log("play") }); => Affichera "play" dans la console JavaScript
+
+#### onMdpEvent ####
+
+Attache un événement Metadataplayer global ("Annotation.show", "search.found", ...) à une fonction. Utilisé de manière similaire à onMediaEvent.
#### Autres fonctions ####
--- a/sbin/build/client.xml Fri Sep 14 10:38:04 2012 +0900
+++ b/sbin/build/client.xml Wed Sep 19 14:11:49 2012 +0900
@@ -23,10 +23,6 @@
<filelist dir="../../src/js/libs" files="LAB.min.js" />
<!-- core files -->
<filelist dir="../../src/js" files="init.js utils.js pop.js model.js defaults.js widgets.js" />
- <!-- players -->
- <fileset dir="../../src/js/players" casesensitive="yes">
- <include name="**/*.js"/>
- </fileset>
<!-- serializers -->
<fileset dir="../../src/js/serializers" casesensitive="yes">
<include name="**/*.js"/>
--- a/src/js/defaults.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/defaults.js Wed Sep 19 14:11:49 2012 +0900
@@ -42,6 +42,18 @@
IriSP.widgetsDir = 'widgets';
IriSP.widgetsRequirements = {
+ PopcornPlayer: {
+ noCss: true,
+ requires: [ "popcorn" ]
+ },
+ JwpPlayer: {
+ noCss: true,
+ requires: [ "jwplayer" ]
+ },
+ DailymotionPlayer: {
+ noCss: true,
+ requires: [ "swfObject" ]
+ },
Sparkline: {
noCss: true,
requires: [ "raphael" ]
@@ -57,7 +69,7 @@
noCss: true,
requires: [ "tracemanager" ]
},
- SlideShare: {
+ Slideshare: {
requires: [ "swfObject" ]
},
Social: {
--- a/src/js/init.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/init.js Wed Sep 19 14:11:49 2012 +0900
@@ -1,4 +1,4 @@
-/* init.js - initialization and configuration of Popcorn and the widgets
+/* init.js - initialization and configuration of the widgets
*/
if (typeof window.IriSP === "undefined") {
@@ -10,43 +10,34 @@
IriSP.Metadataplayer = function(config) {
IriSP.log("IriSP.Metadataplayer constructor");
for (var key in IriSP.guiDefaults) {
- if (IriSP.guiDefaults.hasOwnProperty(key) && !config.gui.hasOwnProperty(key)) {
- config.gui[key] = IriSP.guiDefaults[key]
+ if (IriSP.guiDefaults.hasOwnProperty(key) && !config.hasOwnProperty(key)) {
+ config[key] = IriSP.guiDefaults[key]
}
}
- var _container = document.getElementById(config.gui.container);
+ var _container = document.getElementById(config.container);
_container.innerHTML = '<h3 class="Ldt-Loader">Loading... Chargement...</h3>';
this.sourceManager = new IriSP.Model.Directory();
this.config = config;
- this.callbackQueue = [];
- this.isLoaded = false;
+ this.__events = {};
this.loadLibs();
}
IriSP.Metadataplayer.prototype.toString = function() {
- return 'Metadataplayer in #' + this.config.gui.container;
-}
-
-IriSP.Metadataplayer.prototype.deferCallback = function(_callback) {
- var _this = this;
- IriSP._.defer(function() {
- _callback.call(_this);
- });
+ return 'Metadataplayer in #' + this.config.container;
}
-IriSP.Metadataplayer.prototype.handleCallbacks = function() {
- this.isLoaded = true;
- while (this.callbackQueue.length) {
- this.deferCallback(this.callbackQueue.splice(0,1)[0]);
+IriSP.Metadataplayer.prototype.on = function(_event, _callback) {
+ if (typeof this.__events[_event] === "undefined") {
+ this.__events[_event] = [];
}
+ this.__events[_event].push(_callback);
}
-IriSP.Metadataplayer.prototype.onLoad = function(_callback) {
- if (this.isLoaded) {
- this.deferCallback(_callback);
- } else {
- this.callbackQueue.push(_callback);
- }
+IriSP.Metadataplayer.prototype.trigger = function(_event, _data) {
+ var _element = this;
+ IriSP._(this.__events[_event]).each(function(_callback) {
+ _callback.call(_element, _data);
+ });
}
IriSP.Metadataplayer.prototype.loadLibs = function() {
@@ -54,8 +45,7 @@
var $L = $LAB
.script(IriSP.getLib("underscore"))
.script(IriSP.getLib("Mustache"))
- .script(IriSP.getLib("jQuery"))
- .script(IriSP.getLib("swfObject"));
+ .script(IriSP.getLib("jQuery"));
if (typeof JSON == "undefined") {
$L.script(IriSP.getLib("json"));
@@ -64,17 +54,9 @@
$L.wait()
.script(IriSP.getLib("jQueryUI"));
- if (this.config.player.type === "jwplayer" || this.config.player.type === "auto") {
- $L.script(IriSP.getLib("jwplayer"));
- }
-
- if (this.config.player.type !== "jwplayer" && this.config.player.type !== "allocine" && this.config.player.type !== "dailymotion") {
- $L.script(IriSP.getLib("popcorn"));
- }
-
/* widget specific requirements */
- for(var _i = 0; _i < this.config.gui.widgets.length; _i++) {
- var _t = this.config.gui.widgets[_i].type;
+ for(var _i = 0; _i < this.config.widgets.length; _i++) {
+ var _t = this.config.widgets[_i].type;
if (typeof IriSP.widgetsRequirements[_t] !== "undefined" && typeof IriSP.widgetsRequirements[_t].requires !== "undefined" ) {
for (var _j = 0; _j < IriSP.widgetsRequirements[_t].requires.length; _j++) {
$L.script(IriSP.getLib(IriSP.widgetsRequirements[_t].requires[_j]));
@@ -98,22 +80,25 @@
IriSP._ = window._;
}
IriSP.loadCss(IriSP.getLib("cssjQueryUI"));
- IriSP.loadCss(this.config.gui.css);
+ IriSP.loadCss(this.config.css);
- this.videoData = this.loadMetadata(this.config.player.metadata);
- this.$ = IriSP.jQuery('#' + this.config.gui.container);
+ this.$ = IriSP.jQuery('#' + this.config.container);
this.$.css({
- "width": this.config.gui.width,
+ "width": this.config.width,
"clear": "both"
});
- if (typeof this.config.gui.height !== "undefined") {
- this.$.css("height", this.config.gui.height);
+ if (typeof this.config.height !== "undefined") {
+ this.$.css("height", this.config.height);
}
+ this.widgets = [];
var _this = this;
- this.videoData.onLoad(function() {
- _this.onVideoDataLoaded();
- });
+ for(var i = 0; i < this.config.widgets.length; i++) {
+ this.loadWidget(this.config.widgets[i], function(_widget) {
+ _this.widgets.push(_widget)
+ });
+ };
+ this.$.find('.Ldt-Loader').detach();
}
IriSP.Metadataplayer.prototype.loadMetadata = function(_metadataInfo) {
@@ -130,197 +115,6 @@
}
}
-IriSP.Metadataplayer.prototype.onVideoDataLoaded = function() {
-
- /* Setting default media from metadata */
-
- if (typeof this.videoData !== "undefined") {
-
- var _media;
-
- if (typeof this.videoData.mainMedia !== "undefined") {
- _media = this.videoData.getElement(this.videoData.mainMedia);
- }
-
- if (this.config.player.type === "mashup" || this.config.player.type === "mashup-html") {
- if (typeof _media === "undefined" || _media.elementType !== "mashup") {
- var _mashups = this.videoData.getMashups();
- if (_mashups.length) {
- _media = _mashups[0];
- }
- }
- } else {
- if (typeof _media === "undefined" || _media.elementType !== "media") {
- var _medias = this.videoData.getMedias();
- if (_medias.length) {
- _media = _medias[0];
- }
- }
- }
-
- this.videoData.currentMedia = _media;
-
- /* Getting video URL from metadata if it's not in the player config options */
-
- if (typeof _media !== "undefined" && typeof _media.video !== "undefined" && typeof this.config.player.video === "undefined") {
- this.config.player.video = _media.video;
- if (typeof this.config.player.streamer == "undefined" && typeof _media.streamer !== "undefined") {
- this.config.player.streamer = _media.streamer;
- }
- }
-
- }
-
- if (typeof this.config.player.video === "string" && this.config.player.url_transform === "function") {
- this.config.player.video = this.config.player.url_transform(this.config.player.video);
- }
-
- var _pop,
- _divs = this.layoutDivs("video",this.config.player.height || undefined),
- containerDiv = _divs[0],
- spacerDiv = _divs[1],
- _this = this,
- _types = {
- "html5" : /\.(ogg|ogv|webm)$/,
- "youtube" : /^(https?:\/\/)?(www\.)?youtube\.com/,
- "vimeo" : /^(https?:\/\/)?(www\.)?vimeo\.com/,
- "dailymotion" : /^(https?:\/\/)?(www\.)?dailymotion\.com/
- };
-
- if (this.config.player.type === "auto") {
- this.config.player.type = "jwplayer";
- IriSP._(_types).each(function(_v, _k) {
- if (_v.test(_this.config.player.video)) {
- _this.config.player.type = _k
- }
- });
- }
-
- switch(this.config.player.type) {
- case "html5":
- var _tmpId = Popcorn.guid("video"),
- _videoEl = IriSP.jQuery('<video>');
-
- _videoEl.attr({
- "src" : this.config.player.video,
- "id" : _tmpId
- })
-
- if(this.config.player.hasOwnProperty("width")) {
- _videoEl.attr("width", this.config.player.width);
- }
- if(this.config.player.hasOwnProperty("height")) {
- _videoEl.attr("height", this.config.player.height);
- }
- IriSP.jQuery("#" + containerDiv).append(_videoEl);
- _pop = Popcorn("#" + _tmpId);
- break;
-
- case "html5-audio":
- var _tmpId = Popcorn.guid("audio"),
- _videoEl = IriSP.jQuery('<audio>');
-
- _videoEl.attr({
- "src" : this.config.player.video,
- "id" : _tmpId
- })
-
- if(this.config.player.hasOwnProperty("width")) {
- _videoEl.attr("width", this.config.player.width);
- }
- if(this.config.player.hasOwnProperty("height")) {
- _videoEl.attr("height", this.config.player.height);
- }
- IriSP.jQuery("#" + containerDiv).append(_videoEl);
- _pop = Popcorn("#" + _tmpId);
- break;
-
- case "jwplayer":
- var opts = IriSP.jQuery.extend({}, this.config.player);
- delete opts.container;
- delete opts.type;
- if (typeof opts.streamer === "function") {
- opts.streamer = opts.streamer(opts.video);
- }
- if (typeof opts.streamer === "string") {
- opts.video = opts.video.replace(opts.streamer,"");
- }
- opts.file = opts.video;
- delete opts.video;
- delete opts.metadata;
-
- if(!opts.hasOwnProperty("flashplayer")) {
- opts.flashplayer = IriSP.getLib("jwPlayerSWF");
- }
-
- if(!opts.hasOwnProperty("controlbar.position")) {
- opts["controlbar.position"] = "none";
- }
- _pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
- break;
-
- case "youtube":
- // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div.
- IriSP.jQuery("#" + containerDiv).css({
- width : this.config.player.width + "px",
- height : this.config.player.height + "px"
- });
- var _urlparts = this.config.player.video.split(/[?&]/),
- _params = {};
- for (var _j = 1; _j < _urlparts.length; _j++) {
- var _ppart = _urlparts[_j].split('=');
- _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
- }
- _params.controls = 0;
- _params.modestbranding = 1;
- _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
- _pop = Popcorn.youtube("#" + containerDiv, _url);
- break;
-
- case "vimeo":
- // Popcorn.vimeo wants us to specify the size of the player in the style attribute of its container div.
- IriSP.jQuery("#" + containerDiv).css({
- width : this.config.player.width + "px",
- height : this.config.player.height + "px"
- });
- _pop = Popcorn.vimeo("#" + containerDiv, this.config.player.video);
- break;
-
- case "dailymotion":
- _pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, this.config.player);
- break;
-
- case "mashup":
- _pop = new IriSP.PopcornReplacement.mashup("#" + containerDiv, this.config.player);
- break;
-
- case "allocine":
- _pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, this.config.player);
- break;
-
- case "mashup-html":
- _pop = new IriSP.PopcornReplacement.htmlMashup("#" + containerDiv, this.config.player, this.videoData);
- break;
-
- default:
- _pop = undefined;
- };
-
- this.popcorn = _pop;
-
- /* Now Loading Widgets */
-
- this.widgets = [];
- var _this = this;
- for(var i = 0; i < this.config.gui.widgets.length; i++) {
- this.loadWidget(this.config.gui.widgets[i], function(_widget) {
- _this.widgets.push(_widget)
- });
- };
- this.$.find('.Ldt-Loader').detach();
- this.handleCallbacks();
-}
-
IriSP.Metadataplayer.prototype.loadWidget = function(_widgetConfig, _callback) {
/* Creating containers if needed */
if (typeof _widgetConfig.container === "undefined") {
@@ -354,20 +148,20 @@
if (typeof(_name) === "undefined") {
_name = "";
}
- var newDiv = IriSP._.uniqueId(this.config.gui.container + "_widget_" + _name + "_"),
+ var newDiv = IriSP._.uniqueId(this.config.container + "_widget_" + _name + "_"),
spacerDiv = IriSP._.uniqueId("LdtPlayer_spacer_"),
divHtml = IriSP.jQuery('<div>')
.attr("id",newDiv)
.css({
- width: this.config.gui.width + "px",
+ width: this.config.width + "px",
position: "relative",
clear: "both"
}),
spacerHtml = IriSP.jQuery('<div>')
.attr("id",spacerDiv)
.css({
- width: this.config.gui.width + "px",
- height: this.config.gui.spacer_div_height + "px",
+ width: this.config.width + "px",
+ height: this.config.spacer_div_height + "px",
position: "relative",
clear: "both"
});
--- a/src/js/model.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/model.js Wed Sep 19 14:11:49 2012 +0900
@@ -364,7 +364,7 @@
this.contents = new IriSP.Model.List(this.source.directory);
this.contents.addIds(this.id);
} else {
- this.contents = this.source.directory.getElement(this.id);
+ this.contents = this.source.getElement(this.id);
}
}
@@ -450,6 +450,23 @@
IriSP.Model.Media.prototype = new IriSP.Model.Element();
+/* Default functions to be overriden by players */
+
+IriSP.Model.Media.prototype.getCurrentTime = function() { return new IriSP.Model.Time(0); }
+
+IriSP.Model.Media.prototype.getVolume = function() { return .5; }
+
+IriSP.Model.Media.prototype.getPaused = function() { return true; }
+
+IriSP.Model.Media.prototype.getMuted = function() { return false; }
+
+IriSP.Model.Media.prototype.setCurrentTime
+ = IriSP.Model.Media.prototype.setVolume
+ = IriSP.Model.Media.prototype.setMuted
+ = IriSP.Model.Media.prototype.play
+ = IriSP.Model.Media.prototype.pause
+ = function() {}
+
IriSP.Model.Media.prototype.setDuration = function(_durationMs) {
this.duration.setMilliseconds(_durationMs);
}
@@ -647,6 +664,23 @@
}
}
+/* Default functions to be overriden by players */
+
+IriSP.Model.Mashup.prototype.getCurrentTime = function() { return new IriSP.Model.Time(0); }
+
+IriSP.Model.Mashup.prototype.getVolume = function() { return .5; }
+
+IriSP.Model.Mashup.prototype.getPaused = function() { return true; }
+
+IriSP.Model.Mashup.prototype.getMuted = function() { return false; }
+
+IriSP.Model.Mashup.prototype.setCurrentTime
+ = IriSP.Model.Mashup.prototype.setVolume
+ = IriSP.Model.Mashup.prototype.setMuted
+ = IriSP.Model.Mashup.prototype.play
+ = IriSP.Model.Mashup.prototype.pause
+ = function() {}
+
/* */
IriSP.Model.Source = function(_config) {
@@ -768,6 +802,23 @@
}
}
+IriSP.Model.Source.prototype.getCurrentMedia = function(_opts) {
+ if (typeof this.currentMedia === "undefined") {
+ if (_opts.is_mashup) {
+ var _mashups = this.getMashups();
+ if (_mashups.length) {
+ this.currentMedia = _mashups[0];
+ }
+ } else {
+ var _medias = this.getMedias();
+ if (_medias.length) {
+ _media = _medias[0];
+ }
+ }
+ }
+ return this.currentMedia;
+}
+
IriSP.Model.Source.prototype.merge = function(_source) {
var _this = this;
_source.forEach(function(_value, _key) {
--- a/src/js/players/player.allocine.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.allocine.js Wed Sep 19 14:11:49 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/players/player.dailymotion.js Fri Sep 14 10:38:04 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/* To wrap a player the develop should create a new class derived from
-the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.dailymotion = function(container, options) {
- /* Appel du constructeur de la classe parente */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- var _this = this;
-
- /* Définition des fonctions de commande :
- this.playerFns.play, .pause, .getPosition, .seek,
- .getMute, .setMute, .getVolume, .setVolume
- doivent être rattachés aux fonctions du player
- * */
-
- this.playerFns = {
- play : function() {
- if (_this.player) {
- return _this.player.playVideo();
- } else {
- return false;
- }
- },
- pause : function() {
- if (_this.player) {
- return _this.player.pauseVideo();
- } else {
- return false;
- }
- },
- getPosition : function() {
- if (_this.player) {
- return _this.player.getCurrentTime();
- } else {
- return 0;
- }
- },
- seek : function(pos) {
- if (_this.player) {
- return _this.player.seekTo(pos);
- } else {
- return false;
- }
- },
- getMute : function() {
- if (_this.player) {
- return _this.player.isMuted();
- } else {
- return false;
- }
- },
- setMute : function(p) {
- if (_this.player) {
- if (p) {
- _this.player.mute();
- }
- else {
- _this.player.unMute();
- }
- }
- },
- getVolume : function() {
- if (_this.player) {
- return _this.player.getVolume() / 100;
- } else {
- return false;
- }
- },
- setVolume : function(p) {
- if (_this.player) {
- _this.player.setVolume(Math.floor(100 * p));
- }
- },
- }
-
- /* Dailymotion utilise un système de fonctions référencées dans
- * des variables globales pour la gestion des événements.
- */
-
- window.onDailymotionPlayerReady = function() {
- _this.onReady();
- };
- window.onDailymotionStateChange = function(_state) {
- _this.onStateChange(_state);
- }
- window.onDailymotionVideoProgress = function(_progress) {
- _this.onProgress(_progress);
- }
-
- var params = {
- "allowScriptAccess" : "always",
- "wmode": "opaque"
- };
- var atts = {
- id : this.container
- };
- swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, options.width, options.height, "8", null, null, params, atts);
-
-};
-
-IriSP.PopcornReplacement.dailymotion.prototype = new IriSP.PopcornReplacement.player("", {});
-
-IriSP.PopcornReplacement.dailymotion.prototype.onReady = function() {
-
- this.player = document.getElementById(this.container);
-
- this.player.addEventListener("onStateChange", "onDailymotionStateChange");
- this.player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
- this.player.cueVideoByUrl(this._options.video);
-
- this.trigger("loadedmetadata");
-};
-
-IriSP.PopcornReplacement.dailymotion.prototype.onProgress = function(progressInfo) {
- this.trigger("timeupdate");
-}
-
-IriSP.PopcornReplacement.dailymotion.prototype.onStateChange = function(state) {
-
- switch(state) {
- case 1:
- this.trigger("play");
- break;
-
- case 2:
- this.trigger("pause");
- break;
-
- case 3:
- this.trigger("seeked");
- break;
- }
-
-};
\ No newline at end of file
--- a/src/js/players/player.jwplayer.js Fri Sep 14 10:38:04 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* To wrap a player the develop should create a new class derived from
- the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.jwplayer = function(container, options) {
- /* appel du parent pour initialiser les structures communes à tous les players */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- if (options.autostart) {
- this.media.paused = false;
- this.trigger("play");
- }
-
- var _player = jwplayer(this.container),
- _this = this,
- _seekPause = false;
-
- /* Définition des fonctions de l'API - */
- this.playerFns = {
- play: function() { return _player.play(true); },
- pause: function() { return _player.pause(true); },
- getPosition: function() { return _player.getPosition(); },
- seek: function(pos) {
- _seekPause = _this.media.paused;
- return _player.seek(pos);
- },
- getMute: function() { return _player.getMute() },
- setMute: function(p) { return _player.setMute(p); },
- getVolume: function() { return _player.getVolume() / 100; },
- setVolume: function(p) { return _player.setVolume(Math.floor(100*p)); }
- }
-
- options.events = {
- onReady: function() {
- _this.trigger("loadedmetadata");
- },
- onTime: function() {
- if (_seekPause) {
- _player.pause(true);
- _seekPause = false;
- } else {
- if (_this.media.paused && _player.getState() === "PLAYING") {
- _this.media.paused = false;
- _this.trigger("play");
- }
- }
- _this.trigger("timeupdate");
- },
- onPlay: function() {
- if (!_seekPause) {
- _this.media.paused = false;
- _this.trigger("play");
- }
- },
- onPause: function() {
- _this.media.paused = true;
- _this.trigger("pause");
- },
- onSeek: function() {
- _this.trigger("seeked");
- }
- };
-
- _player.setup(options);
-};
-
-IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});
--- a/src/js/players/player.mashup-html.js Fri Sep 14 10:38:04 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/* To wrap a player the develop should create a new class derived from
- the IriSP.PopcornReplacement.player and defining the correct functions */
-
-/** jwplayer player wrapper */
-IriSP.PopcornReplacement.htmlMashup = function(container, options, metadata) {
- /* appel du parent pour initialiser les structures communes à tous les players */
- IriSP.PopcornReplacement.player.call(this, container, options);
-
- this.mashup = metadata.currentMedia;
- this.$ = IriSP.jQuery(container);
-
- var _w = this.$.width(),
- _h = this.$.height(),
- _this = this;
-
- IriSP._(metadata.currentMedia.medias).each(function(_media) {
- var _tmpId = Popcorn.guid("video"),
- _videoEl = IriSP.jQuery('<video>'),
- _videoUrl = _media.video;
- if (typeof options.url_transform === "function") {
- _videoUrl = options.url_transform(_videoUrl);
- }
-
- _videoEl
- .attr({
- //src : _videoUrl,
- id : _tmpId,
- width : _w,
- height : _h
- })
- .css({
- position: "absolute",
- top: 0,
- left: 0
- });
-
- if(typeof _videoUrl === "string"){
- _videoEl.attr({src : _videoUrl});
- }
- else{
- // _videoUrl is an array of {src:"u",type:"m"}
- l = _videoUrl.length;
- for (var _i = 0; _i < l; _i++) {
- var srcNode = IriSP.jQuery('<source>');
- srcNode.attr({src:_videoUrl[_i]["src"], type:_videoUrl[_i]["type"]});
- _videoEl.append(srcNode);
- }
- }
- _this.$.append(_videoEl);
- _media.videoEl = _videoEl;
- _media.popcorn = Popcorn("#" + _tmpId);
- _media.loadedMetadata = false;
- _media.popcorn.on("loadedmetadata", function() {
- _media.loadedMetadata = true;
- var _allLoaded = true;
- for (var _i = 0; _i < metadata.currentMedia.medias.length; _i++) {
- _allLoaded = _allLoaded && metadata.currentMedia.medias[_i].loadedMetadata;
- }
- if (_allLoaded) {
- _this.changeCurrentAnnotation();
- _this.trigger("loadedmetadata");
- }
- });
- _media.popcorn.on("timeupdate", function() {
- if (!_this.media.paused && _media === _this.currentMedia) {
- var _time = Math.round( 1000 * _media.popcorn.currentTime() );
-// var _status = "Timeupdate from " + _media.id + " at time " + _time;
- if ( _time < _this.segmentEnd ) {
- if ( _time >= _this.segmentBegin ) {
- _this.timecode = _time - _this.timedelta;
-// _status += " within segment";
- } else {
- _this.timecode = _this.segmentBegin - _this.timedelta;
- _media.popcorn.currentTime(_this.segmentBegin / 1000);
-// _status += " before segment";
- }
- } else {
- _this.timecode = _this.segmentEnd - _this.timedelta;
- _media.popcorn.pause();
- _this.changeCurrentAnnotation();
-// _status += " after segment";
- }
-// _status += " (" + _this.segmentBegin + " to " + _this.segmentEnd + ")" + ", translated to " + _this.timecode;
-// console.log(_status);
- _this.trigger("timeupdate");
- }
- });
- });
-
- this.timecode = 0;
-
- /* Définition des fonctions de l'API */
- this.playerFns = {
- play: function() {
- _this.changeCurrentAnnotation();
- },
- pause: function() {
- _this.currentMedia.popcorn.pause();
- },
- getPosition: function() {
- return _this.timecode / 1000;
- },
- seek: function(pos) {
- _this.timecode = Math.round(pos * 1000);
- _this.changeCurrentAnnotation();
- },
- getMute: function() {
- var _res = (
- typeof _this.currentMedia !== "undefined"
- ? _this.currentMedia.popcorn.muted()
- : false
- );
- return _res;
- },
- setMute: function(p) {
- var _mute = !!p;
- for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
- _this.mashup.medias[_i].popcorn.muted(_mute);
- }
- },
- getVolume: function() {
- var _res = (
- typeof _this.currentMedia !== "undefined"
- ? _this.currentMedia.popcorn.volume()
- : .5
- );
- return _res;
- },
- setVolume: function(_vol) {
- for (var _i = 0; _i < _this.mashup.medias.length; _i++) {
- _this.mashup.medias[_i].popcorn.volume(_vol);
- }
- }
- }
-
-};
-
-IriSP.PopcornReplacement.htmlMashup.prototype = new IriSP.PopcornReplacement.player("", {});
-
-IriSP.PopcornReplacement.htmlMashup.prototype.changeCurrentAnnotation = function() {
- var _annotation = this.mashup.getAnnotationAtTime( this.timecode );
- if (typeof _annotation == "undefined") {
- if (typeof this.currentMedia !== "undefined") {
- this.currentMedia.popcorn.pause();
- if (!this.media.paused) {
- this.media.paused = true;
- this.trigger("pause");
- }
- }
- return;
- }
- if (_annotation !== this.currentAnnotation) {
- this.currentAnnotation = _annotation;
- this.segmentBegin = this.currentAnnotation.annotation.begin.milliseconds;
- this.segmentEnd = this.currentAnnotation.annotation.end.milliseconds;
- this.timedelta = this.segmentBegin - this.currentAnnotation.begin.milliseconds;
- this.currentMedia = this.currentAnnotation.getMedia();
-
- for (var _i = 0; _i < this.mashup.medias.length; _i++) {
- if (this.mashup.medias[_i].id !== this.currentMedia.id) {
- this.mashup.medias[_i].videoEl.hide();
- this.mashup.medias[_i].popcorn.pause();
- } else {
- this.mashup.medias[_i].videoEl.show();
- }
- }
-/* PRELOADING */
- var _this = this,
- _preloadedMedias = [],
- _toPreload = this.mashup.getAnnotations().filter(function(_a) {
- return (_a.begin >= _this.currentAnnotation.end && _a.getMedia().id !== _this.currentMedia.id);
- });
- IriSP._(_toPreload).each(function(_a) {
- var _media = _a.getMedia();
- if (IriSP._(_preloadedMedias).indexOf(_media.id) === -1) {
- _preloadedMedias.push(_media.id);
- _media.popcorn.currentTime(_a.annotation.begin.getSeconds());
- //console.log("Preloading ", _media.id, " at t=", _a.annotation.begin.getSeconds());
- }
- });
-
-// console.log("Changed segment: media="+ this.currentMedia.id + ", from=" + this.segmentBegin + " to=" + this.segmentEnd +", timedelta = ", this.timedelta)
-// } else {
-// console.log("changeCurrentAnnotation called, but segment hasn't changed");
- }
- if (this.currentMedia.popcorn.readyState()) {
- this.currentMedia.popcorn.currentTime( (this.timecode + this.timedelta) / 1000);
- this.trigger("timeupdate");
- }
- if (!this.media.paused) {
- this.currentMedia.popcorn.play();
- }
-}
--- a/src/js/players/player.mashup.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/players/player.mashup.js Wed Sep 19 14:11:49 2012 +0900
@@ -1,3 +1,5 @@
+//TODO: Remove and replace by Player Widget
+
/* To wrap a player the develop should create a new class derived from
the IriSP.PopcornReplacement.player and defining the correct functions */
--- a/src/js/pop.js Fri Sep 14 10:38:04 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/* wrapper that simulates popcorn.js because
- popcorn is a bit unstable at the time */
-
-/* Popcorn.code replacement has been disabled. It didn't work properly and was not even used */
-
-IriSP.PopcornReplacement = {
-};
-
-/** base class for our popcorn-compatible players.
- */
-IriSP.PopcornReplacement.player = function(container, options) {
-
- this.media = {
- "paused": true,
- "muted": false
- };
-
- this.container = container.replace(/^#/,''); //remove '#' at beginning
- this.msgPump = {}; /* dictionnary used to receive and send messages */
- this._options = options;
-
-};
-
-IriSP.PopcornReplacement.player.prototype.listen = function(msg, callback) {
- if (!this.msgPump.hasOwnProperty(msg)) {
- this.msgPump[msg] = [];
- }
- this.msgPump[msg].push(callback);
-};
-
-IriSP.PopcornReplacement.player.prototype.on = IriSP.PopcornReplacement.player.prototype.listen;
-
-IriSP.PopcornReplacement.player.prototype.trigger = function(msg, params) {
- if (!this.msgPump.hasOwnProperty(msg)) {
- return;
- }
- var d = this.msgPump[msg];
- for(var i = 0; i < d.length; i++) {
- d[i].call(window, params);
- }
-};
-
-IriSP.PopcornReplacement.player.prototype.emit = IriSP.PopcornReplacement.player.prototype.trigger;
-/*
-IriSP.PopcornReplacement.player.prototype.guid = function(prefix) {
- var str = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- });
-
- return prefix + str;
-};
-
-/** init the api after that flash player has been setup - called by the callback
- defined by the embedded flash player
-
-IriSP.PopcornReplacement.player.prototype.__initApi = function() {
- this.trigger("loadedmetadata"); // we've done more than loading metadata of course,
- // but popcorn doesn't need to know more.
- this.media.muted = this.playerFns.getMute();
- /* some programmed segments are supposed to be run at the beginning
- var i = 0;
- for(i = 0; i < this.__codes.length; i++) {
- var c = this.__codes[i];
- if (0 == c.start) {
- c.onStart();
- }
-
- if (0 == c.end) {
- c.onEnd();
- }
- }
-
-};
-*/
-
-IriSP.PopcornReplacement.player.prototype.currentTime = function(time) {
- if (typeof(time) === "undefined") {
- return this.playerFns.getPosition();
- } else {
- var currentTime = +time;
- this.playerFns.seek(currentTime);
- return currentTime;
- }
-};
-
-IriSP.PopcornReplacement.player.prototype.play = function() {
- this.media.paused = false;
- this.trigger("play");
- this.playerFns.play();
-};
-
-IriSP.PopcornReplacement.player.prototype.pause = function() {
- this.media.paused = true;
- this.trigger("pause");
- this.playerFns.pause();
-};
-
-IriSP.PopcornReplacement.player.prototype.muted = function(val) {
- if (typeof(val) !== "undefined") {
-
- if (this.playerFns.getMute() !== val) {
- if (val) {
- this.playerFns.setMute(true);
- this.media.muted = true;
- } else {
- this.playerFns.setMute(false);
- this.media.muted = false;
- }
-
- this.trigger( "volumechange" );
- }
-
- return this.playerFns.getMute();
- } else {
- return this.playerFns.getMute();
- }
-};
-
-IriSP.PopcornReplacement.player.prototype.volume = function(val) {
- if (typeof this.playerFns.getVolume == "undefined" || typeof this.playerFns.setVolume == "undefined") {
- return false;
- }
- var _vol = this.playerFns.getVolume();
- if (typeof(val) !== "undefined" && parseFloat(val) !== NaN) {
- val = Math.max(0, Math.min(1, val));
- if (parseFloat(val) != parseFloat(_vol)) {
- this.playerFns.setVolume(val);
- this.trigger("volumechange");
- _vol = this.playerFns.getVolume();
- }
- }
- return _vol;
-};
-
-IriSP.PopcornReplacement.player.prototype.mute = function() {
- this.muted(true);
-}
-
-IriSP.PopcornReplacement.player.prototype.unmute = function() {
- this.muted(false);
-}
-
-
-IriSP.PopcornReplacement.player.prototype.roundTime = function() {
- var currentTime = this.currentTime();
- return Math.round(currentTime);
-};
\ No newline at end of file
--- a/src/js/serializers/ldt.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/serializers/ldt.js Wed Sep 19 14:11:49 2012 +0900
@@ -208,7 +208,7 @@
}
if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") {
- _source.mainMedia = _data.meta.main_media["id-ref"];
+ _source.currentMedia = _source.getElement(_data.meta.main_media["id-ref"]);
}
}
}
--- a/src/js/widgets.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/js/widgets.js Wed Sep 19 14:11:49 2012 +0900
@@ -26,7 +26,7 @@
/* Setting all the configuration options */
var _type = config.type,
- _config = IriSP._.defaults({}, config, player.config.gui.default_options, this.defaults),
+ _config = IriSP._.defaults({}, config, player.config.default_options, this.defaults),
_this = this;
IriSP._(_config).forEach(function(_value, _key) {
@@ -34,7 +34,7 @@
});
if (typeof this.width === "undefined") {
- this.width = player.config.gui.width;
+ this.width = player.config.width;
}
/* Setting this.player at the end in case it's been overriden
@@ -47,6 +47,15 @@
/* Call draw when loaded */
this.source.onLoad(function() {
+ if (_this.media_id) {
+ _this.media = this.getElement(_this.media_id);
+ } else {
+ var _mediaopts = {
+ is_mashup: _this.is_mashup || false
+ }
+ _this.media = this.getCurrentMedia(_mediaopts);
+ }
+
_this.draw();
});
@@ -88,27 +97,41 @@
return _function.apply(_this, Array.prototype.slice.call(arguments, 0));
}
} else {
- console.log("Error, Unknown function IriSP." + this.type + "." + _name)
+ console.log("Error, Unknown function IriSP.Widgets" + this.type + "." + _name)
+ }
+}
+
+IriSP.Widgets.Widget.prototype.getFunctionOrName = function(_functionOrName) {
+ switch (typeof _functionOrName) {
+ case "function":
+ return _functionOrName;
+ case "string":
+ return this.functionWrapper(_functionOrName);
+ default:
+ return undefined;
}
}
-IriSP.Widgets.Widget.prototype.bindPopcorn = function(_popcornEvent, _functionName) {
- this.player.popcorn.listen(_popcornEvent, this.functionWrapper(_functionName))
+IriSP.Widgets.Widget.prototype.onMdpEvent = function(_eventName, _functionOrName) {
+ this.player.on(_eventName, this.getFunctionOrName(_functionOrName));
+}
+
+IriSP.Widgets.Widget.prototype.onMediaEvent = function(_eventName, _functionOrName) {
+ this.media.on(_eventName, this.getFunctionOrName(_functionOrName));
}
IriSP.Widgets.Widget.prototype.getWidgetAnnotations = function() {
- var _curmedia = this.source.currentMedia;
- return typeof this.annotation_type !== "undefined" && this.annotation_type ? _curmedia.getAnnotationsByTypeTitle(this.annotation_type) : _curmedia.getAnnotations();
+ return typeof this.annotation_type !== "undefined" && this.annotation_type ? this.media.getAnnotationsByTypeTitle(this.annotation_type) : this.media.getAnnotations();
}
IriSP.Widgets.Widget.prototype.getWidgetAnnotationsAtTime = function() {
- var _time = Math.floor(this.player.popcorn.currentTime() * 1000);
+ var _time = this.media.getCurrentTime();
return this.getWidgetAnnotations().filter(function(_annotation) {
return _annotation.begin <= _time && _annotation.end > _time;
});
}
-IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _propname, _widgetoptions) {
+IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _widgetoptions, _propname) {
var _id = _selector.attr("id"),
_this = this,
_type = _widgetoptions.type,
@@ -125,7 +148,9 @@
}
$L.wait(function() {
_this.player.loadWidget(_widgetoptions, function(_widget) {
- _this[_propname] = _widget;
+ if (_propname) {
+ _this[_propname] = _widget;
+ }
});
});
}
--- a/src/widgets/Annotation.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Annotation.js Wed Sep 19 14:11:49 2012 +0900
@@ -50,38 +50,37 @@
IriSP.Widgets.Annotation.prototype.draw = function() {
this.renderTemplate();
- this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), "socialWidget", { type: "Social" });
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.bindPopcorn("IriSP.Annotation.hide","hide");
- this.bindPopcorn("IriSP.Annotation.show","show");
- this.bindPopcorn("IriSP.Annotation.minimize","minimize");
- this.bindPopcorn("IriSP.Annotation.maximize","maximize");
- this.bindPopcorn("IriSP.Annotation.getBounds","sendBounds");
+ this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), { type: "Social" }, "socialWidget");
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onMdpEvent("Annotation.hide","hide");
+ this.onMdpEvent("Annotation.show","show");
+ this.onMdpEvent("Annotation.minimize","minimize");
+ this.onMdpEvent("Annotation.maximize","maximize");
+ this.onMdpEvent("Annotation.getBounds","sendBounds");
this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize"));
this.onTimeupdate();
}
-IriSP.Widgets.Annotation.prototype.onTimeupdate = function() {
- var _time = Math.floor(this.player.popcorn.currentTime() * 1000),
- _list = this.getWidgetAnnotationsAtTime();
+IriSP.Widgets.Annotation.prototype.onTimeupdate = function(_time) {
+ var _list = this.getWidgetAnnotationsAtTime();
if (_list.length) {
if (_list[0].id !== this.lastAnnotation) {
this.drawAnnotation(_list[0]);
this.bounds = [ _list[0].begin.valueOf(), _list[0].end.valueOf() ];
}
- this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2});
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2});
}
else {
this.lastAnnotation = false;
this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty");
- this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: _time});
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
this.bounds = [ _time, _time ];
}
this.sendBounds();
}
IriSP.Widgets.Annotation.prototype.sendBounds = function() {
- this.player.popcorn.trigger("IriSP.Annotation.boundsChanged",this.bounds);
+ this.player.trigger("Annotation.boundsChanged",this.bounds);
}
IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) {
@@ -107,7 +106,7 @@
});
this.$.find('.Ldt-Annotation-TagLabel').click(function() {
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
+ _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
});
} else {
this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock");
--- a/src/widgets/AnnotationsList.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/AnnotationsList.js Wed Sep 19 14:11:49 2012 +0900
@@ -6,7 +6,6 @@
this.throttledRefresh = IriSP._.throttle(function() {
_this.refresh(false);
}, 1500);
- this.mashupMode = (this.source.currentMedia.elementType === "mashup");
};
IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget();
@@ -79,9 +78,9 @@
var _n = this.refresh(true);
if (this.searchString) {
if (_n) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
}
}
@@ -89,11 +88,8 @@
//obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() {
- var _currentTime = this.player.popcorn.currentTime(),
- _duration = this.source.getDuration();
- if (typeof _currentTime == "undefined") {
- _currentTime = 0;
- }
+ var _currentTime = this.media.getCurrentTime(),
+ _duration = this.media.duration;
this.lastAjaxQuery = _currentTime;
_currentTime = Math.floor(1000 * _currentTime);
var _url = Mustache.to_html(this.ajax_url, {
@@ -107,11 +103,8 @@
}
IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() {
- var _currentTime = this.player.popcorn.currentTime();
- if (typeof _currentTime == "undefined") {
- _currentTime = 0;
- }
- var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
+ var _currentTime = this.media.getCurrentTime();
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
this.lastMashupAnnotation = _currentAnnotation.id;
var _currentMedia = _currentAnnotation.getMedia(),
@@ -132,13 +125,10 @@
return 0;
}
var _this = this,
- _currentTime = this.player.popcorn.currentTime();
- if (typeof _currentTime == "undefined") {
- _currentTime = 0;
- }
+ _currentTime = this.media.getCurrentTime();
var _list = this.annotation_type ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type) : this.currentSource.getAnnotations();
if (this.mashupMode) {
- var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
+ var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
if (typeof _currentAnnotation !== "undefined") {
_currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds();
var _mediaId = _currentAnnotation.getMedia().id;
@@ -246,7 +236,7 @@
});
this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() {
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
+ _this.player.trigger("search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
})
if(this.searchString) {
@@ -272,14 +262,16 @@
IriSP.Widgets.AnnotationsList.prototype.draw = function() {
+ this.mashupMode = (this.media.elementType === "mashup");
+
this.renderTemplate();
this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
- this.bindPopcorn("IriSP.AnnotationsList.refresh","refresh");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
+ this.onMdpEvent("AnnotationsList.refresh","refresh");
var _this = this;
@@ -299,14 +291,14 @@
}, this.refresh_interval);
}
+ this.onMdpEvent("createAnnotationWidget.addedAnnotation");
var _events = [
- "IriSP.createAnnotationWidget.addedAnnotation",
"timeupdate",
"seeked",
"loadedmetadata"
];
for (var _i = 0; _i < _events.length; _i++) {
- this.player.popcorn.listen(_events[_i], this.throttledRefresh);
+ this.onMediaEvent(_events[_i], this.throttledRefresh);
}
this.throttledRefresh();
--- a/src/widgets/Arrow.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Arrow.js Wed Sep 19 14:11:49 2012 +0900
@@ -33,9 +33,9 @@
fill: this.fill_url ? ( 'url(' + this.fill_url + ')' ) : this.fill_color
});
this.moveTo(0);
- this.bindPopcorn("IriSP.Arrow.updatePosition","onUpdatePosition");
- this.bindPopcorn("IriSP.Arrow.takeover","onTakeover");
- this.bindPopcorn("IriSP.Arrow.release","onRelease");
+ this.onMdpEvent("Arrow.updatePosition","onUpdatePosition");
+ this.onMdpEvent("Arrow.takeover","onTakeover");
+ this.onMdpEvent("Arrow.release","onRelease");
}
IriSP.Widgets.Arrow.prototype.drawAt = function(_x) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/AutoPlayer.js Wed Sep 19 14:11:49 2012 +0900
@@ -0,0 +1,57 @@
+IriSP.Widgets.AutoPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AutoPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AutoPlayer.prototype.defaults = {
+ default_type: "JwpPlayer"
+}
+
+IriSP.Widgets.AutoPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ var _props = [ "live", "provider", "autostart", "streamer", "video", "height", "width", "url_transform" ],
+ _opts = {},
+ _types = [
+ {
+ regexp: /\.(ogg|ogv|webm)$/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?youtube\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?vimeo\.com/,
+ type: "PopcornPlayer"
+ },
+ {
+ regexp: /^(https?:\/\/)?(www\.)?dailymotion\.com/,
+ type: "DailymotionPlayer"
+ }
+ ];
+
+ for (var i = 0; i < _types.length; i++) {
+ if (_types[i].regexp.test(this.video)) {
+ _opts.type = _types[i].type
+ }
+ }
+
+ if (typeof _opts.type === "undefined") {
+ _opts.type = this.default_type
+ }
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+
+ this.insertSubwidget(this.$, _opts);
+
+}
\ No newline at end of file
--- a/src/widgets/Controller.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Controller.js Wed Sep 19 14:11:49 2012 +0900
@@ -87,22 +87,21 @@
this.$volumeBar = this.$.find(".Ldt-Ctrl-Volume-Bar");
// handle events
- this.bindPopcorn("play","playButtonUpdater");
- this.bindPopcorn("pause","playButtonUpdater");
- this.bindPopcorn("volumechange","volumeUpdater");
- this.bindPopcorn("timeupdate","timeDisplayUpdater");
- this.bindPopcorn("loadedmetadata","timeDisplayUpdater");
- this.bindPopcorn("loadedmetadata","volumeUpdater");
- this.bindPopcorn("IriSP.search.matchFound","searchMatch");
- this.bindPopcorn("IriSP.search.noMatchFound","searchNoMatch");
- this.bindPopcorn("IriSP.search.triggeredSearch","triggeredSearch");
- this.bindPopcorn("IriSP.search.cleared","hideSearchBlock");
+ this.onMediaEvent("play","playButtonUpdater");
+ this.onMediaEvent("pause","playButtonUpdater");
+ this.onMediaEvent("volumechange","volumeUpdater");
+ this.onMediaEvent("timeupdate","timeDisplayUpdater");
+ this.onMediaEvent("loadedmetadata","volumeUpdater");
+ this.onMdpEvent("search.matchFound","searchMatch");
+ this.onMdpEvent("search.noMatchFound","searchNoMatch");
+ this.onMdpEvent("search.triggeredSearch","triggeredSearch");
+ this.onMdpEvent("search.cleared","hideSearchBlock");
// handle clicks
this.$playButton.click(this.functionWrapper("playHandler"));
this.$.find(".Ldt-Ctrl-Annotate").click(function() {
- _this.player.popcorn.trigger("IriSP.CreateAnnotation.toggle");
+ _this.player.trigger("CreateAnnotation.toggle");
});
this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler"));
@@ -143,7 +142,7 @@
this.$volumeBar.slider({
slide: function(event, ui) {
_this.$volumeBar.attr("title",_this.l10n.volume+': ' + ui.value + '%');
- _this.player.popcorn.volume(ui.value / 100);
+ _this.media.setVolume(ui.value / 100);
},
stop: this.functionWrapper("volumeUpdater")
});
@@ -151,33 +150,26 @@
// trigger an IriSP.Player.MouseOver to the widgets that are interested (i.e : sliderWidget)
this.$.hover(
function() {
- _this.player.popcorn.trigger("IriSP.Player.MouseOver");
+ _this.player.trigger("Player.MouseOver");
},
function() {
- _this.player.popcorn.trigger("IriSP.Player.MouseOut");
+ _this.player.trigger("Player.MouseOut");
});
+
+ this.timeDisplayUpdater(new IriSP.Model.Time(0));
/* some players - including jwplayer - save the state of the mute button between sessions */
-
+ //TODO: MOVE TO THE PLAYER/
window.setTimeout(this.functionWrapper("volumeUpdater"), 1000);
};
/* Update the elasped time div */
-IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function() {
- var _curTime = this.player.popcorn.roundTime();
- if (typeof this._previousSecond !== "undefined" && _curTime === this._previousSecond) {
- return;
- }
+IriSP.Widgets.Controller.prototype.timeDisplayUpdater = function(_time) {
// we get it at each call because it may change.
- var _totalTime = this.source.getDuration(),
- _elapsedTime = new IriSP.Model.Time();
-
- _elapsedTime.setSeconds(_curTime);
-
- this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_elapsedTime.toString());
+ var _totalTime = this.media.duration;
+ this.$.find(".Ldt-Ctrl-Time-Elapsed").html(_time.toString());
this.$.find(".Ldt-Ctrl-Time-Total").html(_totalTime.toString());
- this._previousSecond = _curTime;
};
/* update the icon of the button - separate function from playHandler
@@ -185,10 +177,7 @@
the jwplayer window) we have to change the icon without playing/pausing
*/
IriSP.Widgets.Controller.prototype.playButtonUpdater = function() {
-
- var status = this.player.popcorn.media.paused;
-
- if (status) {
+ if (this.media.getPaused()) {
/* the background sprite is changed by adding/removing the correct classes */
this.$playButton
.attr("title", this.l10n.play)
@@ -204,23 +193,24 @@
IriSP.Widgets.Controller.prototype.playHandler = function() {
-
- var status = this.player.popcorn.media.paused;
-
- if (status) {
- this.player.popcorn.play();
+ if (this.media.getPaused()) {
+ this.media.play();
} else {
- this.player.popcorn.pause();
+ this.media.pause();
}
};
IriSP.Widgets.Controller.prototype.muteHandler = function() {
- this.player.popcorn.muted(!this.player.popcorn.muted());
+ if (this.media.getMuted()) {
+ this.media.unmute();
+ } else {
+ this.media.mute();
+ }
};
IriSP.Widgets.Controller.prototype.volumeUpdater = function() {
- var _muted = this.player.popcorn.muted(),
- _vol = this.player.popcorn.volume();
+ var _muted = this.media.getMuted(),
+ _vol = this.media.getVolume();
if (_vol === false) {
_vol = .5;
}
@@ -249,13 +239,13 @@
this._positiveMatch = false;
// tell the world the field is open
- this.player.popcorn.trigger("IriSP.search.open");
+ this.player.trigger("search.open");
};
IriSP.Widgets.Controller.prototype.hideSearchBlock = function() {
this.$searchBlock.animate( { width: 0 }, 200);
this._positiveMatch = false;
- this.player.popcorn.trigger("IriSP.search.closed");
+ this.player.trigger("search.closed");
};
/** react to clicks on the search button */
@@ -264,7 +254,7 @@
this.showSearchBlock();
var _val = this.$searchInput.val();
if (_val) {
- this.player.popcorn.trigger("IriSP.search", _val); // trigger the search to make it more natural.
+ this.player.trigger("search", _val); // trigger the search to make it more natural.
}
} else {
this.hideSearchBlock();
@@ -284,9 +274,9 @@
// do nothing if the search field is empty, instead of highlighting everything.
if (_val !== this.lastSearchValue) {
if (_val) {
- this.player.popcorn.trigger("IriSP.search", _val);
+ this.player.trigger("search", _val);
} else {
- this.player.popcorn.trigger("IriSP.search.cleared");
+ this.player.trigger("search.cleared");
this.$searchInput.css('background-color','');
}
}
@@ -314,7 +304,7 @@
IriSP.Widgets.Controller.prototype.triggeredSearch = function(searchString) {
this.showSearchBlock();
this.$searchInput.attr('value', searchString);
- this.player.popcorn.trigger("IriSP.search", searchString); // trigger the search to make it more natural.
+ this.player.trigger("search", searchString); // trigger the search to make it more natural.
};
--- a/src/widgets/CreateAnnotation.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/CreateAnnotation.js Wed Sep 19 14:11:49 2012 +0900
@@ -163,8 +163,8 @@
this.hide();
}
- this.bindPopcorn("IriSP.CreateAnnotation.toggle","toggle");
- this.bindPopcorn("IriSP.Slice.boundsChanged","onBoundsChanged");
+ this.onMdpEvent("CreateAnnotation.toggle","toggle");
+ this.onMdpEvent("Slice.boundsChanged","onBoundsChanged");
this.begin = new IriSP.Model.Time();
this.end = this.source.getDuration();
this.$.find("form").submit(this.functionWrapper("onSubmit"));
@@ -188,9 +188,9 @@
this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected");
this.$.slideDown();
if (this.minimize_annotation_widget) {
- this.player.popcorn.trigger("IriSP.Annotation.minimize");
+ this.player.trigger("Annotation.minimize");
}
- this.player.popcorn.trigger("IriSP.Slice.show");
+ this.player.trigger("Slice.show");
}
IriSP.Widgets.CreateAnnotation.prototype.hide = function() {
@@ -198,9 +198,9 @@
this.visible = false;
this.$.slideUp();
if (this.minimize_annotation_widget) {
- this.player.popcorn.trigger("IriSP.Annotation.maximize");
+ this.player.trigger("Annotation.maximize");
}
- this.player.popcorn.trigger("IriSP.Slice.hide");
+ this.player.trigger("Slice.hide");
}
}
@@ -234,8 +234,8 @@
}
IriSP.Widgets.CreateAnnotation.prototype.pauseOnWrite = function() {
- if (this.pause_on_write && !this.player.popcorn.media.paused) {
- this.player.popcorn.pause();
+ if (this.pause_on_write && !this.media.getPaused()) {
+ this.media.pause();
}
}
@@ -344,10 +344,10 @@
_export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */
_export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */
_this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */
- if (_this.pause_on_write && _this.player.popcorn.media.paused) {
- _this.player.popcorn.play();
+ if (_this.pause_on_write && _this.media.getPaused()) {
+ _this.media.play();
}
- _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
+ _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */
},
error: function(_xhr, _error, _thrown) {
IriSP.log("Error when sending annotation", _thrown);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/DailymotionPlayer.js Wed Sep 19 14:11:49 2012 +0900
@@ -0,0 +1,104 @@
+IriSP.Widgets.DailymotionPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.DailymotionPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.DailymotionPlayer.prototype.defaults = {
+ aspect_ratio: 14/9
+}
+
+IriSP.Widgets.DailymotionPlayer.prototype.draw = function() {
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ this.height = this.height || Math.floor(this.width / this.aspect_ratio);
+
+ var _media = this.media,
+ _this = this,
+ _pauseState = true;
+
+ /* Dailymotion utilise un système de fonctions référencées dans
+ * des variables globales pour la gestion des événements.
+ */
+
+ window.onDailymotionPlayerReady = function() {
+
+ var _player = document.getElementById(_this.container);
+
+ _media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_player.getCurrentTime());
+ }
+ _media.getVolume = function() {
+ return _player.getVolume() / 100;
+ }
+ _media.getPaused = function() {
+ return _pauseState;
+ }
+ _media.getMuted = function() {
+ return _player.isMuted();
+ }
+ _media.setCurrentTime = function(_milliseconds) {
+ _seekPause = _pauseState;
+ return _player.seekTo(_milliseconds / 1000);
+ }
+ _media.setVolume = function(_vol) {
+ return _player.setVolume(Math.floor(_vol*100));
+ }
+ _media.mute = function() {
+ return _player.mute();
+ }
+ _media.unmute = function() {
+ return _player.unMute();
+ }
+ _media.play = function() {
+ return _player.playVideo();
+ }
+ _media.pause = function() {
+ return _player.pauseVideo();
+ }
+
+ _player.addEventListener("onStateChange", "onDailymotionStateChange");
+ _player.addEventListener("onVideoProgress", "onDailymotionVideoProgress");
+
+ _player.cueVideoByUrl(_this.video);
+
+ _media.trigger("loadedmetadata");
+ }
+
+ window.onDailymotionStateChange = function(_state) {
+ switch(_state) {
+ case 1:
+ _media.trigger("play");
+ _pauseState = false;
+ break;
+
+ case 2:
+ _media.trigger("pause");
+ _pauseState = true;
+ break;
+
+ case 3:
+ _media.trigger("seeked");
+ break;
+ }
+ }
+
+ window.onDailymotionVideoProgress = function(_progress) {
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.mediaTime * 1000));
+ }
+
+ var params = {
+ "allowScriptAccess" : "always",
+ "wmode": "opaque"
+ };
+
+ var atts = {
+ id : this.container
+ };
+
+ swfobject.embedSWF("http://www.dailymotion.com/swf?chromeless=1&enableApi=1", this.container, this.width, this.height, "8", null, null, params, atts);
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/JwpPlayer.js Wed Sep 19 14:11:49 2012 +0900
@@ -0,0 +1,119 @@
+IriSP.Widgets.JwpPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.JwpPlayer.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.JwpPlayer.prototype.defaults = {
+}
+
+IriSP.Widgets.JwpPlayer.prototype.draw = function() {
+
+ var _opts = {},
+ _player = jwplayer(this.$[0]),
+ _seekPause = false,
+ _pauseState = true,
+ _props = [ "live", "provider", "autostart" ];
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (typeof this.streamer === "function") {
+ this.streamer = this.streamer(this.video);
+ }
+
+ if (typeof this.streamer === "string") {
+ this.video = this.video.replace(this.streamer,"");
+ _opts.streamer = this.streamer;
+ }
+
+ _opts.file = this.video;
+ _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
+ _opts["controlbar.position"] = "none";
+ _opts.width = this.width;
+ _opts.height = this.height || Math.floor(.643*this.width);
+
+ for (var i = 0; i < _props.length; i++) {
+ if (typeof this[_props[i]] !== "undefined") {
+ _opts[_props[i]] = this[_props[i]];
+ }
+ }
+
+ if (this.autostart) {
+ _pauseState = false;
+ this.media.trigger("play");
+ }
+ // Binding functions to jwplayer
+
+ this.media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_player.getPosition());
+ }
+ this.media.getVolume = function() {
+ return _player.getVolume() / 100;
+ }
+ this.media.getPaused = function() {
+ return _pauseState;
+ }
+ this.media.getMuted = function() {
+ return _player.getMute();
+ }
+ this.media.setCurrentTime = function(_milliseconds) {
+ _seekPause = _pauseState;
+ return _player.seek(_milliseconds / 1000);
+ }
+ this.media.setVolume = function(_vol) {
+ return _player.setVolume(Math.floor(_vol*100));
+ }
+ this.media.mute = function() {
+ return _player.setMute(true);
+ }
+ this.media.unmute = function() {
+ return _player.setMute(false);
+ }
+ this.media.play = function() {
+ return _player.play(true);
+ }
+ this.media.pause = function() {
+ return _player.pause(true);
+ }
+
+ // Binding jwplater events to media
+
+ var _media = this.media;
+
+ _opts.events = {
+ onReady: function() {
+ _media.trigger("loadedmetadata");
+ },
+ onTime: function(_progress) {
+ if (_seekPause) {
+ _player.pause(true);
+ _seekPause = false;
+ } else {
+ if (_pauseState && _player.getState() === "PLAYING") {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ }
+ _media.trigger("timeupdate", new IriSP.Model.Time(_progress.position * 1000));
+ },
+ onPlay: function() {
+ if (!_seekPause) {
+ _pauseState = false;
+ _media.trigger("play");
+ }
+ },
+ onPause: function() {
+ _pauseState = true;
+ _media.trigger("pause");
+ },
+ onSeek: function() {
+ _media.trigger("seeked");
+ }
+ }
+ _player.setup(_opts);
+
+ this.jwplayer = _player;
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/MashupPlayer.js Wed Sep 19 14:11:49 2012 +0900
@@ -0,0 +1,207 @@
+IriSP.Widgets.MashupPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+ this.is_mashup = true;
+};
+
+IriSP.Widgets.MashupPlayer.prototype = new IriSP.Widgets.Widget();
+
+/* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */
+
+IriSP.Widgets.MashupPlayer.prototype.defaults = {
+ aspect_ratio: 14/9,
+ player_type: "PopcornPlayer"
+}
+
+IriSP.Widgets.MashupPlayer.prototype.draw = function() {
+ var _this = this,
+ _mashup = this.media,
+ _pauseState = true,
+ _currentMedia = null,
+ _currentAnnotation = null,
+ _segmentBegin,
+ _segmentEnd,
+ _timecode = 0,
+ _timedelta;
+
+ function changeCurrentAnnotation() {
+ var _annotation = _mashup.getAnnotationAtTime( _timecode );
+ if (typeof _annotation === "undefined") {
+ if (_currentMedia) {
+ _currentMedia.pause();
+ if (!_pauseState) {
+ _pauseState = true;
+ _mashup.trigger("pause");
+ }
+ }
+ return;
+ }
+ if (_annotation !== _currentAnnotation) {
+ _currentAnnotation = _annotation;
+ _segmentBegin = _currentAnnotation.annotation.begin.milliseconds;
+ _segmentEnd = _currentAnnotation.annotation.end.milliseconds;
+ _timedelta = _segmentBegin - _currentAnnotation.begin.milliseconds;
+ _currentMedia = _currentAnnotation.getMedia();
+
+ for (var _i = 0; _i < _mashup.medias.length; _i++) {
+ if (_mashup.medias[_i].id !== _currentMedia.id) {
+ _mashup.medias[_i].hide();
+ _mashup.medias[_i].pause();
+ } else {
+ _mashup.medias[_i].show();
+ }
+ }
+
+ /* PRELOADING */
+ var _preloadedMedias = [],
+ _toPreload = _mashup.getAnnotations().filter(function(_a) {
+ return (_a.begin >= _currentAnnotation.end && _a.getMedia() !== _currentMedia);
+ });
+ IriSP._(_toPreload).each(function(_a) {
+ var _media = _a.getMedia();
+ if (IriSP._(_preloadedMedias).indexOf(_media.id) === -1) {
+ _preloadedMedias.push(_media.id);
+ _media.setCurrentTime(_a.annotation.begin.getSeconds());
+ //console.log("Preloading ", _media.id, " at t=", _a.annotation.begin.getSeconds());
+ }
+ });
+
+ // console.log("Changed segment: media="+ this.currentMedia.id + ", from=" + this.segmentBegin + " to=" + this.segmentEnd +", timedelta = ", this.timedelta)
+ // } else {
+ // console.log("changeCurrentAnnotation called, but segment hasn't changed");
+ }
+
+ _currentMedia.setCurrentTime( _timecode + _timedelta);
+ _mashup.trigger("timeupdate", new IriSP.Model.Time(_timecode));
+
+ if (!_pauseState) {
+ _currentMedia.play();
+ }
+ }
+
+ if (!this.height) {
+ this.height = Math.floor(this.width/this.aspect_ratio);
+ this.$.css({
+ height: this.height
+ });
+ }
+
+ IriSP._(_mashup.medias).each(function(_media) {
+ var _el = IriSP.jQuery('<div>');
+ _el.css({
+ position: "absolute",
+ top: 0,
+ left: 0,
+ height: _this.height,
+ width: _this.width
+ });
+ _this.$.append(_el);
+
+ _this.insertSubwidget(
+ _el,
+ {
+ type: _this.player_type,
+ media_id: _media.id,
+ height: _this.height,
+ width: _this.width,
+ url_transform: _this.url_transform
+ }
+ );
+
+ _media.loadedMetadata = false;
+ _media.show = function() {
+ _el.show();
+ };
+ _media.hide = function() {
+ _el.hide();
+ };
+ _media.on("loadedmetadata", function() {
+ _media.loadedMetadata = true;
+ var _allLoaded = true;
+ for (var _i = 0; _i < _mashup.medias.length; _i++) {
+ _allLoaded = _allLoaded && _mashup.medias[_i].loadedMetadata;
+ }
+ if (_allLoaded) {
+ changeCurrentAnnotation();
+ _mashup.trigger("loadedmetadata");
+ }
+ });
+ _media.on("timeupdate", function(_time) {
+ if (!_pauseState && _media === _currentMedia) {
+// var _status = "Timeupdate from " + _media.id + " at time " + _time;
+ if ( _time < _segmentEnd ) {
+ if ( _time >= _segmentBegin ) {
+ _timecode = _time - _timedelta;
+// _status += " within segment";
+ } else {
+ _timecode = _segmentBegin - _timedelta;
+ _media.setCurrentTime(_segmentBegin);
+// _status += " before segment";
+ }
+ } else {
+ _timecode = _segmentEnd - _timedelta;
+ _media.pause();
+ changeCurrentAnnotation();
+// _status += " after segment";
+ }
+// _status += " (" + _this.segmentBegin + " to " + _this.segmentEnd + ")" + ", translated to " + _this.timecode;
+// console.log(_status);
+ _mashup.trigger("timeupdate", new IriSP.Model.Time(_timecode));
+ }
+ });
+ _media.on("play", function() {
+ if (_media === _currentMedia) {
+ _mashup.trigger("play");
+ }
+ });
+ _media.on("pause", function() {
+ if (_media === _currentMedia) {
+ _mashup.trigger("pause");
+ }
+ });
+ });
+
+ _mashup.getCurrentTime = function() {
+ return new IriSP.Model.Time(_timecode);
+ }
+ _mashup.getVolume = function() {
+ return ( _currentMedia ? _currentMedia.getVolume() : .5 );
+ }
+ _mashup.getPaused = function() {
+ return _pauseState;
+ }
+ _mashup.getMuted = function() {
+ return ( _currentMedia ? _currentMedia.getMuted() : false );
+ }
+ _mashup.setCurrentTime = function(_milliseconds) {
+ _timecode = _milliseconds;
+ changeCurrentAnnotation();
+ }
+ _mashup.setVolume = function(_vol) {
+ for (var _i = 0; _i < _mashup.medias.length; _i++) {
+ _mashup.medias[_i].setVolume(_vol);
+ }
+ }
+ _mashup.mute = function() {
+ for (var _i = 0; _i < _mashup.medias.length; _i++) {
+ _mashup.medias[_i].mute();
+ }
+ }
+ _mashup.unmute = function() {
+ for (var _i = 0; _i < _mashup.medias.length; _i++) {
+ _mashup.medias[_i].unmute();
+ }
+ }
+ _mashup.play = function() {
+ _pauseState = false;
+ changeCurrentAnnotation();
+ }
+ _mashup.pause = function() {
+ _pauseState = true;
+ if (_currentMedia) {
+ _currentMedia.pause();
+ }
+ }
+
+ changeCurrentAnnotation();
+
+}
\ No newline at end of file
--- a/src/widgets/MediaList.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/MediaList.js Wed Sep 19 14:11:49 2012 +0900
@@ -49,15 +49,15 @@
var _n = this.refresh(true);
if (this.searchString) {
if (_n) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
}
}
IriSP.Widgets.MediaList.prototype.draw = function() {
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
this.$.addClass("Ldt-MediaListWidget")
this.renderTemplate();
this.redraw();
@@ -124,10 +124,10 @@
}
};
-IriSP.Widgets.MediaList.prototype.onTimeupdate = function() {
+IriSP.Widgets.MediaList.prototype.onTimeupdate = function(_time) {
var _media = this.source.currentMedia;
if (_media.elementType === "mashup") {
- _media = _media.getMediaAtTime(this.player.popcorn.currentTime() * 1000);
+ _media = _media.getMediaAtTime(_time);
}
if (typeof _media !== "undefined" && _media.id !== this.lastMedia) {
this.lastMedia = _media.id;
--- a/src/widgets/Mediafragment.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Mediafragment.js Wed Sep 19 14:11:49 2012 +0900
@@ -10,15 +10,15 @@
}
})
};
- this.bindPopcorn("pause","setHashToTime");
- this.bindPopcorn("seeked","setHashToTime");
- this.bindPopcorn("IriSP.Mediafragment.setHashToAnnotation","setHashToAnnotation");
+ this.onMdpEvent("Mediafragment.setHashToAnnotation","setHashToAnnotation");
this.blocked = false;
}
IriSP.Widgets.Mediafragment.prototype = new IriSP.Widgets.Widget();
IriSP.Widgets.Mediafragment.prototype.draw = function() {
+ this.onMediaEvent("pause","setHashToTime");
+ this.onMediaEvent("seeked","setHashToTime");
this.goToHash();
}
@@ -52,11 +52,11 @@
if (this.last_hash_key == "id") {
var _annotation = this.source.getElement(this.last_hash_value);
if (typeof _annotation !== "undefined") {
- this.player.popcorn.currentTime(_annotation.begin.getSeconds());
+ this.media.setCurrentTime(_annotation.begin);
}
}
if (this.last_hash_key == "t") {
- this.player.popcorn.currentTime(this.last_hash_value);
+ this.media.setCurrentTime(1000*this.last_hash_value);
}
break;
}
@@ -68,10 +68,8 @@
this.setHash( 'id', _annotationId );
}
-IriSP.Widgets.Mediafragment.prototype.setHashToTime = function(_time) {
- if (_time !== NaN) {
- this.setHash( 't', this.player.popcorn.currentTime() );
- }
+IriSP.Widgets.Mediafragment.prototype.setHashToTime = function() {
+ this.setHash( 't', this.media.getCurrentTime().getSeconds() );
}
IriSP.Widgets.Mediafragment.prototype.setHash = function(_key, _value) {
@@ -100,5 +98,5 @@
window.clearTimeout(this.blockTimeout);
}
this.blocked = true;
- this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1000);
+ this.blockTimeout = window.setTimeout(this.functionWrapper("unblock"), 1500);
}
--- a/src/widgets/Polemic.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Polemic.js Wed Sep 19 14:11:49 2012 +0900
@@ -76,16 +76,16 @@
});
if (this.searchString) {
if (_found) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
}
}
IriSP.Widgets.Polemic.prototype.draw = function() {
- this.bindPopcorn("timeupdate", "onTimeupdate");
+ this.onMediaEvent("timeupdate", "onTimeupdate");
this.$zone = IriSP.jQuery('<div>');
this.$zone.addClass("Ldt-Polemic");
this.$.append(this.$zone);
@@ -168,8 +168,8 @@
}).mouseout(function() {
_annotation.trigger("unselect");
}).click(function() {
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _annotation.id);
- _this.player.popcorn.trigger("IriSP.Tweet.show", _annotation.id);
+ _this.player.trigger("Mediafragment.setHashToAnnotation", _annotation.id);
+ _this.player.trigger("Tweet.show", _annotation.id);
});
_annotation.on("select", function() {
_this.tooltip.show(
@@ -214,9 +214,9 @@
this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv");
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
} else {
this.$zone.hide();
@@ -303,16 +303,16 @@
this.$zone.click(function(_e) {
var _x = _e.pageX - _this.$zone.offset().left;
- _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width);
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
});
this.$.append('<div class="Ldt-Polemic-Tooltip"></div>');
- this.insertSubwidget(this.$.find(".Ldt-Polemic-Tooltip"), "tooltip", { type: "Tooltip" });
+ this.insertSubwidget(this.$.find(".Ldt-Polemic-Tooltip"), { type: "Tooltip" }, "tooltip");
}
-IriSP.Widgets.Polemic.prototype.onTimeupdate = function() {
- var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Polemic.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
this.$elapsed.css({
width: _x + "px"
});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/widgets/PopcornPlayer.js Wed Sep 19 14:11:49 2012 +0900
@@ -0,0 +1,132 @@
+IriSP.Widgets.PopcornPlayer = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.PopcornPlayer.prototype = new IriSP.Widgets.Widget();
+
+/* A Popcorn-based player for HTML5 Video, Youtube and Vimeo */
+
+IriSP.Widgets.PopcornPlayer.prototype.defaults = {
+ aspect_ratio: 14/9
+}
+
+IriSP.Widgets.PopcornPlayer.prototype.draw = function() {
+
+
+ if (typeof this.video === "undefined") {
+ this.video = this.media.video;
+ }
+
+ if (this.url_transform) {
+ this.video = this.url_transform(this.video);
+ }
+
+ if (!this.height) {
+ this.height = Math.floor(this.width/this.aspect_ratio);
+ this.$.css({
+ height: this.height
+ });
+ }
+
+ if (/^(https?:\/\/)?(www\.)?vimeo\.com/.test(this.video)) {
+
+ /* VIMEO */
+
+ var _popcorn = Popcorn.vimeo(this.container, this.video);
+
+ } else if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) {
+
+ /* YOUTUBE */
+
+ var _urlparts = this.video.split(/[?&]/),
+ _params = {};
+ for (var i = 1; i < _urlparts.length; i++) {
+ var _ppart = _urlparts[i].split('=');
+ _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
+ }
+ _params.controls = 0;
+ _params.modestbranding = 1;
+ _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
+
+ var _popcorn = Popcorn.youtube(this.container, _url);
+
+ } else {
+
+ /* DEFAULT HTML5 */
+
+ var _tmpId = IriSP._.uniqueId("popcorn"),
+ _videoEl = IriSP.jQuery('<video>');
+ _videoEl.attr({
+ id : _tmpId,
+ width : this.width,
+ height : this.height
+ });
+ if(typeof this.video === "string"){
+ _videoEl.attr("src",this.video);
+ } else {
+ for (var i = 0; i < this.video.length; i++) {
+ var _srcNode = IriSP.jQuery('<source>');
+ _srcNode.attr({
+ src: this.video[i].src,
+ type: this.video[i].type
+ });
+ _videoEl.append(_srcNode);
+ }
+ }
+ this.$.html(_videoEl);
+ var _popcorn = Popcorn("#" + _tmpId);
+ }
+
+ // Binding functions to Popcorn
+
+ this.media.getCurrentTime = function() {
+ return new IriSP.Model.Time(1000*_popcorn.currentTime());
+ }
+ this.media.getVolume = function() {
+ return _popcorn.volume();
+ }
+ this.media.getPaused = function() {
+ return _popcorn.media.paused;
+ }
+ this.media.getMuted = function() {
+ return _popcorn.muted();
+ }
+ this.media.setCurrentTime = function(_milliseconds) {
+ return _popcorn.currentTime(_milliseconds / 1000);
+ }
+ this.media.setVolume = function(_vol) {
+ return _popcorn.volume(_vol);
+ }
+ this.media.mute = function() {
+ return _popcorn.muted(true);
+ }
+ this.media.unmute = function() {
+ return _popcorn.muted(false);
+ }
+ this.media.play = function() {
+ return _popcorn.play();
+ }
+ this.media.pause = function() {
+ return _popcorn.pause();
+ }
+
+ // Binding Popcorn events to media
+
+ var _media = this.media;
+ _popcorn.on("timeupdate", function() {
+ _media.trigger("timeupdate", _media.getCurrentTime());
+ });
+
+ function simpleEventBind(_eventname) {
+ _popcorn.on(_eventname, function() {
+ _media.trigger(_eventname);
+ });
+ }
+
+ simpleEventBind("play");
+ simpleEventBind("pause");
+ simpleEventBind("seeked");
+ simpleEventBind("loadedmetadata");
+ simpleEventBind("volumechange");
+
+}
\ No newline at end of file
--- a/src/widgets/Renkan.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Renkan.js Wed Sep 19 14:11:49 2012 +0900
@@ -82,27 +82,26 @@
}
});
_node.on("click", function() {
- _this.player.popcorn.currentTime(_ann.begin.getSeconds());
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _ann.id);
+ _this.media.setCurrentTime(_ann.begin);
+ _this.player.trigger("Mediafragment.setHashToAnnotation", _ann.id);
});
});
}
var _tagmatch = _uri.match(_this.tag_regexp);
if (_tagmatch) {
_node.on("select", function() {
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch",_tagmatch[1]);
+ _this.player.trigger("search.triggeredSearch",_tagmatch[1]);
})
_node.on("unselect", function() {
- _this.player.popcorn.trigger("IriSP.search.cleared");
+ _this.player.trigger("search.cleared");
})
}
});
})
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
}
-IriSP.Widgets.Renkan.prototype.onTimeupdate = function() {
- var _time = 1000 * this.player.popcorn.currentTime();
+IriSP.Widgets.Renkan.prototype.onTimeupdate = function(_time) {
IriSP._(this.node_times).each(function(_nt) {
if (_nt.begin <= _time && _nt.end >= _time) {
if (!_nt.selected) {
--- a/src/widgets/Segments.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Segments.js Wed Sep 19 14:11:49 2012 +0900
@@ -23,10 +23,10 @@
IriSP.Widgets.Segments.prototype.draw = function() {
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
- this.bindPopcorn("timeupdate", "onTimeupdate");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
+ this.onMediaEvent("timeupdate", "onTimeupdate");
this.renderTemplate();
@@ -44,8 +44,7 @@
var _left = _annotation.begin * _scale,
_width = ( _annotation.getDuration() ) * _scale,
_center = Math.floor( _left + _width / 2 ),
- _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' ),
- _beginseconds = _annotation.begin.getSeconds();
+ _fulltext = _annotation.title + ( _annotation.description ? ( '<br/>' + _annotation.description ) : '' );
var _data = {
color : ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ),
text: _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
@@ -63,8 +62,8 @@
_annotation.trigger("unselect");
})
.click(function() {
- _this.player.popcorn.currentTime(_beginseconds);
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _data.id);
+ _this.media.setCurrentTime(_annotation.begin);
+ _this.player.trigger("Mediafragment.setHashToAnnotation", _data.id);
})
.appendTo(_this.list_$)
_annotation.on("select", function() {
@@ -77,7 +76,7 @@
_this.$segments.removeClass("inactive active");
});
});
- this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), "tooltip", { type: "Tooltip" });
+ this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), { type: "Tooltip" }, "tooltip");
this.$segments = this.$.find('.Ldt-Segments-Segment');
}
@@ -96,17 +95,17 @@
}
});
if (_found) {
- this.player.popcorn.trigger("IriSP.search.matchFound");
+ this.player.trigger("search.matchFound");
} else {
- this.player.popcorn.trigger("IriSP.search.noMatchFound");
+ this.player.trigger("search.noMatchFound");
}
} else {
this.$segments.removeClass("found unfound");
}
}
-IriSP.Widgets.Segments.prototype.onTimeupdate = function() {
- var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Segments.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
this.$.find('.Ldt-Segments-Position').css({
left: _x + "px"
})
--- a/src/widgets/Slice.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Slice.js Wed Sep 19 14:11:49 2012 +0900
@@ -40,28 +40,28 @@
min: 0,
max: this.max,
change: function(event, ui) {
- _this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{
+ _this.player.trigger("Arrow.updatePosition",{
widget:_this.type,
time:Math.floor((ui.values[0]+ui.values[1])/2)
});
- _this.player.popcorn.trigger("IriSP.Slice.boundsChanged",[ui.values[0], ui.values[1]]);
+ _this.player.trigger("Slice.boundsChanged",[ui.values[0], ui.values[1]]);
},
start: function() {
_this.sliding = true;
- if (!_this.player.popcorn.media.paused) {
- _this.player.popcorn.pause();
+ if (!_this.media.getPaused) {
+ _this.media.pause();
}
- _currentTime = _this.player.popcorn.currentTime();
+ _currentTime = _this.media.getCurrentTime();
},
slide: function(event, ui) {
if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) {
return false;
}
- _this.player.popcorn.currentTime(ui.value / 1000);
+ _this.media.setCurrentTime(ui.value);
},
stop: function() {
_this.sliding = false;
- _this.player.popcorn.currentTime(_currentTime);
+ _this.media.setCurrentTime(_currentTime);
}
});
this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle");
@@ -71,25 +71,25 @@
} else {
this.hide();
}
- this.bindPopcorn("IriSP.Slice.show","show");
- this.bindPopcorn("IriSP.Slice.hide","hide");
- this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds");
- this.player.popcorn.trigger("IriSP.Annotation.getBounds");
+ this.onMdpEvent("Slice.show","show");
+ this.onMdpEvent("Slice.hide","hide");
+ this.onMdpEvent("Annotation.boundsChanged","storeBounds");
+ this.player.trigger("Annotation.getBounds");
};
IriSP.Widgets.Slice.prototype.show = function() {
this.$slider.show();
- this.player.popcorn.trigger("IriSP.Arrow.takeover",this.type);
+ this.player.trigger("Arrow.takeover",this.type);
this.$slider.slider("values", [this.min, this.max]);
}
IriSP.Widgets.Slice.prototype.hide = function() {
this.$slider.hide();
- this.player.popcorn.trigger("IriSP.Arrow.release");
+ this.player.trigger("Arrow.release");
}
IriSP.Widgets.Slice.prototype.storeBounds = function(_values) {
- if (!this.player.popcorn.media.paused && (this.min != _values[0] || this.max != _values[1])) {
+ if (!this.media.getPaused() && (this.min != _values[0] || this.max != _values[1])) {
this.min = _values[0];
this.max = _values[1];
if (this.live_update && !this.sliding) {
--- a/src/widgets/Slider.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Slider.js Wed Sep 19 14:11:49 2012 +0900
@@ -30,16 +30,16 @@
min: 0,
max: this.source.getDuration().milliseconds,
slide: function(event, ui) {
- _this.player.popcorn.currentTime(ui.value / 1000);
- _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToTime");
+ _this.media.setCurrentTime(ui.value);
+ _this.player.trigger("Mediafragment.setHashToTime");
}
});
this.$handle = this.$slider.find('.ui-slider-handle');
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.bindPopcorn("IriSP.PlayerWidget.MouseOver","onMouseover");
- this.bindPopcorn("IriSP.PlayerWidget.MouseOut","onMouseout");
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onMdpEvent("Player.MouseOver","onMouseover");
+ this.onMdpEvent("Player.MouseOut","onMouseout");
if (this.minimize_timeout) {
this.$slider.css(this.calculateSliderCss(this.minimized_height));
@@ -54,10 +54,9 @@
}
};
-IriSP.Widgets.Slider.prototype.onTimeupdate = function() {
- var _time = 1000 * this.player.popcorn.currentTime();
+IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
this.$slider.slider("value",_time);
- this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: _time});
+ this.player.trigger("Arrow.updatePosition",{widget: this.type, time: _time});
}
IriSP.Widgets.Slider.prototype.onMouseover = function() {
--- a/src/widgets/Slideshare.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Slideshare.js Wed Sep 19 14:11:49 2012 +0900
@@ -42,12 +42,12 @@
} else {
this.renderTemplate();
this.$container = this.$.find(".Ldt-SlideShare-Container");
- this.bindPopcorn("timeupdate","onTimeupdate");
- this.onTimeupdate();
+ this.onMediaEvent("timeupdate","onTimeupdate");
+ this.onTimeupdate(0);
}
}
-IriSP.Widgets.Slideshare.prototype.onTimeupdate = function() {
+IriSP.Widgets.Slideshare.prototype.onTimeupdate = function(_time) {
var _list = this.getWidgetAnnotationsAtTime();
if (_list.length) {
var _description = _list[0].description,
--- a/src/widgets/Sparkline.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Sparkline.js Wed Sep 19 14:11:49 2012 +0900
@@ -1,6 +1,5 @@
IriSP.Widgets.Sparkline = function(player, config) {
IriSP.Widgets.Widget.call(this, player, config);
- //this.bindPopcorn("timeupdate", "onTimeupdate");
};
IriSP.Widgets.Sparkline.prototype = new IriSP.Widgets.Widget();
@@ -68,14 +67,14 @@
this.$.click(function(_e) {
var _x = _e.pageX - _this.$.offset().left;
- _this.player.popcorn.currentTime(_this.source.getDuration().getSeconds() * _x / _this.width);
+ _this.media.setCurrentTime(_this.media.duration * _x / _this.width);
});
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
}
-IriSP.Widgets.Sparkline.prototype.onTimeupdate = function() {
- var _x = Math.floor( this.width * this.player.popcorn.currentTime() / this.source.getDuration().getSeconds());
+IriSP.Widgets.Sparkline.prototype.onTimeupdate = function(_time) {
+ var _x = Math.floor( this.width * _time / this.media.duration);
this.rectangleProgress.attr({
"width" : _x
});
--- a/src/widgets/Tagcloud.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tagcloud.js Wed Sep 19 14:11:49 2012 +0900
@@ -39,20 +39,19 @@
}
IriSP.Widgets.Tagcloud.prototype.draw = function() {
- this.bindPopcorn("IriSP.search", "onSearch");
- this.bindPopcorn("IriSP.search.closed", "onSearch");
- this.bindPopcorn("IriSP.search.cleared", "onSearch");
+ this.onMdpEvent("search", "onSearch");
+ this.onMdpEvent("search.closed", "onSearch");
+ this.onMdpEvent("search.cleared", "onSearch");
if (this.segment_annotation_type) {
- this.bindPopcorn("timeupdate","onTimeupdate");
+ this.onMediaEvent("timeupdate","onTimeupdate");
} else {
this.redraw();
}
}
-IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function() {
- var _time = Math.floor(this.player.popcorn.currentTime() * 1000),
- _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
+IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) {
+ var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
return _annotation.begin <= _time && _annotation.end > _time;
});
if (_list.length) {
@@ -117,7 +116,7 @@
this.$.html(Mustache.to_html(this.template, {words: _words }));
this.$.find(".Ldt-Tagcloud-item").click(function() {
var _txt = IriSP.jQuery(this).attr("content");
- _this.player.popcorn.trigger("IriSP.search.triggeredSearch", _txt);
+ _this.player.trigger("search.triggeredSearch", _txt);
});
}
--- a/src/widgets/Tagger.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tagger.js Wed Sep 19 14:11:49 2012 +0900
@@ -130,7 +130,7 @@
_this.player.popcorn.play();
}
/* On force le rafraîchissement du widget AnnotationsList */
- _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh");
+ _this.player.trigger("AnnotationsList.refresh");
},
error: function(_xhr, _error, _thrown) {
console.log("Error when sending annotation", _thrown);
--- a/src/widgets/Tooltip.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tooltip.js Wed Sep 19 14:11:49 2012 +0900
@@ -1,6 +1,6 @@
/* this widget displays a small tooltip */
-IriSP.Widgets.Tooltip = function(Popcorn, config, Serializer) {
- IriSP.Widgets.Widget.call(this, Popcorn, config, Serializer);
+IriSP.Widgets.Tooltip = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
};
IriSP.Widgets.Tooltip.prototype = new IriSP.Widgets.Widget();
--- a/src/widgets/Trace.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Trace.js Wed Sep 19 14:11:49 2012 +0900
@@ -22,15 +22,17 @@
return;
}
var _this = this,
- _listeners = {
- "IriSP.search.open" : 0,
- "IriSP.search.closed" : 0,
- "IriSP.search" : 0,
- "IriSP.search.cleared" : 0,
- "IriSP.search.matchFound" : 0,
- "IriSP.search.noMatchFound" : 0,
- "IriSP.search.triggeredSearch" : 0,
- "IriSP.TraceWidget.MouseEvents" : 0,
+ _mdplisteners = {
+ "search.open" : 0,
+ "search.closed" : 0,
+ "search" : 0,
+ "search.cleared" : 0,
+ "search.matchFound" : 0,
+ "search.noMatchFound" : 0,
+ "search.triggeredSearch" : 0,
+ "TraceWidget.MouseEvents" : 0
+ }
+ _medialisteners = {
"play" : 0,
"pause" : 0,
"volumechange" : 0,
@@ -39,14 +41,23 @@
"pause" : 0,
"timeupdate" : 2000
};
- IriSP._(_listeners).each(function(_ms, _listener) {
+ IriSP._(_mdplisteners).each(function(_ms, _listener) {
var _f = function(_arg) {
_this.eventHandler(_listener, _arg);
}
if (_ms) {
_f = IriSP._.throttle(_f, _ms);
}
- _this.player.popcorn.listen(_listener, _f);
+ _this.onMdpEvent(_listener, _f);
+ });
+ IriSP._(_medialisteners).each(function(_ms, _listener) {
+ var _f = function(_arg) {
+ _this.eventHandler(_listener, _arg);
+ }
+ if (_ms) {
+ _f = IriSP._.throttle(_f, _ms);
+ }
+ _this.media.on(_listener, _f);
});
if (!this.tracer) {
@@ -91,7 +102,7 @@
switch(_e.type) {
case "mouseover":
if (_this.lastTarget != _lastTarget) {
- _this.player.popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ _this.player.trigger('TraceWidget.MouseEvents', _data);
} else {
if (typeof _this.moTimeout != "undefined") {
clearTimeout(_this.moTimeout);
@@ -105,12 +116,12 @@
}
_this.moTimeout = setTimeout(function() {
if (_lastTarget != _this.lastTarget) {
- _this.player.popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ _this.player.trigger('TraceWidget.MouseEvents', _data);
}
},100);
break;
default:
- _this.player.popcorn.trigger('IriSP.TraceWidget.MouseEvents', _data);
+ _this.player.trigger('TraceWidget.MouseEvents', _data);
}
_this.lastTarget = _lastTarget;
});
@@ -130,16 +141,16 @@
delete _arg.widget;
delete _arg.type;
break;
- case 'timeupdate':
case 'play':
case 'pause':
- _arg.time = this.player.popcorn.currentTime() * 1000;
+ _arg.milliseconds = this.media.getCurrentTime().milliseconds;
+ case 'timeupdate':
case 'seeked':
case 'volumechange':
- _traceName += 'Popcorn_' + _listener;
+ _traceName += 'media_' + _listener;
break;
default:
- _traceName += _listener.replace('IriSP.','').replace('.','_');
+ _traceName += _listener.replace('.','_');
}
this.lastEvent = _traceName;
if (typeof this.extend === "object" && this.extend) {
--- a/src/widgets/Tweet.js Fri Sep 14 10:38:04 2012 +0900
+++ b/src/widgets/Tweet.js Wed Sep 19 14:11:49 2012 +0900
@@ -66,7 +66,7 @@
IriSP.Widgets.Tweet.prototype.draw = function() {
this.renderTemplate();
- this.bindPopcorn("IriSP.Tweet.show","show");
+ this.onMdpEvent("Tweet.show","show");
this.pinned = this.pin_at_start;
var _this = this;
this.$.find(".Ldt-Tweet-Pin").click(function() {
@@ -170,7 +170,7 @@
this.$.find(".Ldt-Tweet-Retweet").attr("href", "https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str);
this.$.find(".Ldt-Tweet-Reply").attr("href", "https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str);
this.$.find(".Ldt-Tweet-Original").attr("href", "https://twitter.com/" + _tweet.source.user.screen_name + "/status/" + _tweet.source.id_str);
- this.player.popcorn.trigger("IriSP.Annotation.minimize");
+ this.player.trigger("Annotation.minimize");
this.$.slideDown();
this.cancelTimeout();
if (!this.pinned) {
@@ -182,7 +182,7 @@
}
IriSP.Widgets.Tweet.prototype.hide = function() {
- this.player.popcorn.trigger("IriSP.Annotation.maximize");
+ this.player.trigger("Annotation.maximize");
this.$.slideUp();
this.cancelTimeout();
}
--- a/test/audiomp3.htm Fri Sep 14 10:38:04 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-<!doctype html>
-<html>
-
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>Metadataplayer test with HTML5 / MP3 Audio</title>
- <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
- <link href='test.css' rel='stylesheet' type='text/css'>
- <script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
- </head>
-
- <body>
- <h1>Metadataplayer test with HTML5 / MP3 Audio (NOT SUPPORTED BY CHROME & FIREFOX)</h1>
- <div id="LdtPlayer"></div>
- <div id="AnnotationsListContainer"></div>
- <script type="text/javascript">
- IriSP.jwplayer_swf_path = "player.swf";
- IriSP.libFiles.defaultDir = "libs/";
- IriSP.widgetsDir = "metadataplayer";
- var _metadata = {
- url: 'json/ldt-ogv.json',
- format: 'ldt'
- };
- var _config = {
- gui: {
- width : 620,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
- },
- css : 'metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Sparkline" },
- { type: "Slider" },
- { type: "Controller" },
- { type: "Polemic" },
- { type: "Segments" },
- { type: "Slice" },
- { type: "Arrow" },
- { type: "Annotation" },
- { type: "Tweet" },
- {
- type: "Tagcloud",
- segment_annotation_type: "chap"
- },
- {
- type: "AnnotationsList",
- container: "AnnotationsListContainer"
- }
- ]
- },
- player:{
- type:'html5-audio',
- video: 'wari_0710.mp3',
- live: true,
- height: 1,
- width: 1,
- }
- };
- var _myPlayer = new IriSP.Metadataplayer(_config, _metadata);
- </script>
- </body>
-</html>
--- a/test/dailymotion.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/dailymotion.htm Wed Sep 19 14:11:49 2012 +0900
@@ -15,7 +15,40 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- testConfig('json/ldt-dailymotion.json', true, 'http://www.dailymotion.com/video/xodjrx_data-expression_creation');
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: "json/ldt-dailymotion.json",
+ format: 'ldt'
+};
+var _config = {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "AutoPlayer" },
+ { type: "Sparkline" },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ { type: "CreateAnnotation" },
+ { type: "Tweet" },
+ { type: "Tagcloud" },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+};
+_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>
--- a/test/ext-trace.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/ext-trace.htm Wed Sep 19 14:11:49 2012 +0900
@@ -9,7 +9,6 @@
<script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
<script type="text/javascript" src="libs/jquery.min.js"></script>
<script type="text/javascript" src="libs/tracemanager.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
</head>
<body>
@@ -17,78 +16,74 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- IriSP.libFiles.locations.jwPlayerSWF = "player.swf";
- IriSP.libFiles.defaultDir = "libs/";
- IriSP.language = 'fr';
- IriSP.widgetsDir = "metadataplayer";
- var _tracer = tracemanager.init_trace("test", {
- url: "http://traces.advene.org:5000/",
- requestmode: "GET",
- syncmode: "sync",
- default_subject: "tests-Metadataplayer"
- });
- _tracer.trace("CallFromOutside");
- var _metadata = {
- url: 'json/ldt-jwplayer.json',
- format: 'ldt'
- };
- var _config = {
- gui: {
- width : 550,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
- },
- css : 'metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- { type: "Polemic" },
- { type: "Segments" },
- { type: "Slice" },
- {
- type: "Arrow",
- base_height: 4
- },
- { type: "Annotation" },
- {
- type: "CreateAnnotation",
- api_endpoint_template: "http://capsicum/pf/ldtplatform/api/ldt/annotations/{{id}}.json",
- creator_name: "Metadataplayer",
- creator_avatar: "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
- tag_titles: ["#amateur", "#digital-humanities"]
- },
- { type: "Tweet" },
- {
- type: "Tagcloud"
- },
- {
- type: "AnnotationsList",
- container: "AnnotationsListContainer",
- default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png"
- },
- {
- type: "Trace",
- tracer: _tracer,
- js_console: true,
- extend: {
- test: 42
- }
- }
- ]
- },
- player:{
- type:'auto',
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.language = 'fr';
+IriSP.widgetsDir = "metadataplayer";
+var _tracer = tracemanager.init_trace("test", {
+ url: "http://traces.advene.org:5000/",
+ requestmode: "GET",
+ syncmode: "sync",
+ default_subject: "tests-Metadataplayer"
+ });
+_tracer.trace("CallFromOutside");
+var _metadata = {
+ url: 'json/ldt-ogv.json',
+ format: 'ldt'
+};
+var _config = {
+ width : 550,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "AutoPlayer",
live: true,
height: 350,
width: 550,
provider: "rtmp",
- autostart: true,
- metadata: _metadata
+ autostart: true
+ },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ {
+ type: "Arrow",
+ base_height: 4
+ },
+ { type: "Annotation" },
+ {
+ type: "CreateAnnotation",
+ api_endpoint_template: "http://capsicum/pf/ldtplatform/api/ldt/annotations/{{id}}.json",
+ creator_name: "Metadataplayer",
+ creator_avatar: "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
+ tag_titles: ["#amateur", "#digital-humanities"]
+ },
+ { type: "Tweet" },
+ {
+ type: "Tagcloud"
+ },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer",
+ default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png"
+ },
+ {
+ type: "Trace",
+ tracer: _tracer,
+ js_console: true,
+ extend: {
+ test: 42
+ }
}
- };
-
- var _myPlayer = new IriSP.Metadataplayer(_config);
+ ]
+};
+
+var _myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
--- a/test/jwplayer.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/jwplayer.htm Wed Sep 19 14:11:49 2012 +0900
@@ -23,65 +23,61 @@
// url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/5a893570-ca73-11e1-9443-00145ea4a2be?callback=?',
format: 'ldt'
};
- var _config = {
- gui: {
- width : 550,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
- },
- css : 'metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- { type: "Polemic" },
- { type: "Segments" },
- { type: "Slice" },
- {
- type: "Arrow",
- base_height: 4
- },
- { type: "Annotation" },
- {
- type: "CreateAnnotation",
- api_endpoint_template: "post-test.php",
- creator_name: "Metadataplayer",
- creator_avatar: "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
- tag_titles: ["#amateur", "#digital-humanities"]
- },
- { type: "Tweet" },
- {
- type: "Tagger",
- api_endpoint: "post-test.php"
- },
- {
- type: "Tagcloud"
- },
- {
- type: "AnnotationsList",
- container: "AnnotationsListContainer",
- default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png"
- },
- { type: "Mediafragment"}
- ]
+ var _config = {
+ width : 550,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
},
- player:{
- type:'auto',
- live: true,
- height: 350,
- width: 550,
- provider: "rtmp",
- streamer: function(_url) {
- var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
- if (_matches) {
- return _matches[0];
- } else {
- return _url;
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "AutoPlayer",
+ live: true,
+ width: 550,
+ provider: "rtmp",
+ autostart: true,
+ streamer: function(_url) {
+ var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
+ if (_matches) {
+ return _matches[0];
+ } else {
+ return _url;
+ }
}
},
- //autostart: true,
- metadata: _metadata
- }
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ {
+ type: "Arrow",
+ base_height: 4
+ },
+ { type: "Annotation" },
+ {
+ type: "CreateAnnotation",
+ api_endpoint_template: "post-test.php",
+ creator_name: "Metadataplayer",
+ creator_avatar: "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
+ tag_titles: ["#amateur", "#digital-humanities"]
+ },
+ { type: "Tweet" },
+ {
+ type: "Tagger",
+ api_endpoint: "post-test.php"
+ },
+ {
+ type: "Tagcloud"
+ },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer",
+ default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png"
+ },
+ { type: "Mediafragment"}
+ ]
};
var _myPlayer = new IriSP.Metadataplayer(_config);
--- a/test/mashup/moon.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/mashup/moon.htm Wed Sep 19 14:11:49 2012 +0900
@@ -54,53 +54,47 @@
format: 'ldt'
};
var _canPlayMp4 = document.createElement('video').canPlayType('video/mp4');
-var _config = {
- gui: {
- width : 630,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
+var _config = {
+ width : 630,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : '../metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "MashupPlayer",
+ url_transform: function(_url) {
+ if (_canPlayMp4 == "maybe" || _canPlayMp4 == "probably") {
+ return _url.replace(/\.webm$/i,'.mp4');
+ } else {
+ return _url.replace(/\.mp4$/i,'.webm');
+ }
+
+ }
},
- css : '../metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- {
- type: "Segments",
- annotation_type: false
- },
- { type: "Arrow" },
- {
- type: "Annotation",
- annotation_type: false
- },
- {
- type: "MediaList",
- container: "mediaList"
- },
- {
- type: "AnnotationsList",
- container: "AnnotationsListContainer",
- default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png"
- },
- { type: "Mediafragment" }
- ]
- },
- player:{
- type: 'mashup-html',
- url_transform: function(_url) {
- if (_canPlayMp4 == "maybe" || _canPlayMp4 == "probably") {
- return _url.replace(/\.webm$/i,'.mp4');
- } else {
- return _url.replace(/\.mp4$/i,'.webm');
- }
-
+ { type: "Slider" },
+ { type: "Controller" },
+ {
+ type: "Segments",
+ annotation_type: false
+ },
+ { type: "Arrow" },
+ {
+ type: "Annotation",
+ annotation_type: false
},
- height: 350,
- width: 630,
- autostart: true,
- metadata: _metadata
- }
+ {
+ type: "MediaList",
+ container: "mediaList"
+ },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer",
+ default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png"
+ },
+ { type: "Mediafragment" }
+ ]
};
_myPlayer = new IriSP.Metadataplayer(_config);
--- a/test/mashup/player-html.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/mashup/player-html.htm Wed Sep 19 14:11:49 2012 +0900
@@ -72,61 +72,55 @@
IriSP.widgetsDir = "../metadataplayer";
IriSP.language = 'fr';
var _metadata = {
-// url: 'bab_files/mashup.json',
+ url: 'bab_files/mashup.json',
// url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/b2754186-a0c9-11e0-b8bd-00145ea49a02?callback=?',
// url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/5afd8bbe-9b75-11e1-9e5d-00145ea4a2be?callback=?',
// url: 'http://localhost/pf/ldtplatform/ldt/mashupbytag/?tag=projection',
- url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/mashupbytag/?tag=mashuptag&callback=?',
+// url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/mashupbytag/?tag=mashuptag&callback=?',
// url: 'http://localhost/pf/ldtplatform/ldt/mashupbytag/?tag=mashuptag&in=240000&out=1860000',
format: 'ldt'
};
-var _canPlayMp4 = document.createElement('video').canPlayType('video/mp4');
var _config = {
- gui: {
- width : 630,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
+ width : 630,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : '../metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "MashupPlayer",
+ url_transform: url_transform_func
+ },
+ { type: "Slider" },
+ { type: "Controller" },
+ {
+ type: "Segments",
+ annotation_type: false
},
- css : '../metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- {
- type: "Segments",
- annotation_type: false
- },
- { type: "Arrow" },
- {
- type: "Annotation",
- annotation_type: false
- },
- {
- type: "Tagger",
- api_endpoint: "../post-test.php",
- tags: ["actif","amour","bonheur","captif","charité","désir","dieu","doute","famille","idéal","internationale","passif","patrie","peur","politique","président","spleen","travail"]
- },
- {
- type: "MediaList",
- container: "mediaList"
- },
- {
- type: "AnnotationsList",
- container: "annotationList",
- //ajax_url: "http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?",
- //ajax_granularity: 30000,
- //limit_count: 3
- },
- { type: "Mediafragment" }
- ]
- },
- player:{
- type:'mashup-html',
- url_transform: url_transform_func,
- height: 350,
- width: 630,
- metadata: _metadata
- }
+ { type: "Arrow" },
+ {
+ type: "Annotation",
+ annotation_type: false
+ },
+ {
+ type: "Tagger",
+ api_endpoint: "../post-test.php",
+ tags: ["actif","amour","bonheur","captif","charité","désir","dieu","doute","famille","idéal","internationale","passif","patrie","peur","politique","président","spleen","travail"]
+ },
+ {
+ type: "MediaList",
+ container: "mediaList"
+ },
+ {
+ type: "AnnotationsList",
+ container: "annotationList",
+ //ajax_url: "http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?",
+ //ajax_granularity: 30000,
+ //limit_count: 3
+ },
+ { type: "Mediafragment" }
+ ]
};
_myPlayer = new IriSP.Metadataplayer(_config);
--- a/test/mashup/player-local-html.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/mashup/player-local-html.htm Wed Sep 19 14:11:49 2012 +0900
@@ -55,46 +55,39 @@
url: 'bab_files/mashup-local-html.json',
format: 'ldt'
};
-var _config = {
- gui: {
- width : 630,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
+var _config = {
+ width : 630,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : '../metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "MashupPlayer" },
+ { type: "Slider" },
+ { type: "Controller" },
+ {
+ type: "Segments",
+ annotation_type: false
},
- css : '../metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- {
- type: "Segments",
- annotation_type: false
- },
- { type: "Arrow" },
- {
- type: "Annotation",
- annotation_type: false
- },
- {
- type: "MediaList",
- container: "mediaList"
- },
- {
- type: "AnnotationsList",
- container: "annotationList",
- ajax_url: "http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?",
- ajax_granularity: 30000,
- limit_count: 3
- },
- { type: "Mediafragment" }
- ]
- },
- player:{
- type:'mashup-html',
- height: 350,
- width: 630,
- metadata: _metadata
- }
+ { type: "Arrow" },
+ {
+ type: "Annotation",
+ annotation_type: false
+ },
+ {
+ type: "MediaList",
+ container: "mediaList"
+ },
+ {
+ type: "AnnotationsList",
+ container: "annotationList",
+ ajax_url: "http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?",
+ ajax_granularity: 30000,
+ limit_count: 3
+ },
+ { type: "Mediafragment" }
+ ]
};
_myPlayer = new IriSP.Metadataplayer(_config);
--- a/test/mp4video.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/mp4video.htm Wed Sep 19 14:11:49 2012 +0900
@@ -7,7 +7,6 @@
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='test.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
</head>
<body>
@@ -15,7 +14,43 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- testConfig('json/ldt-ogv.json', true, "trailer.mp4", "html5");
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: "json/ldt-ogv.json",
+ format: 'ldt'
+};
+var _config = {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "PopcornPlayer",
+ video: "trailer.mp4"
+ },
+ { type: "Sparkline" },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ { type: "CreateAnnotation" },
+ { type: "Tweet" },
+ { type: "Tagcloud" },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+};
+_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>
--- a/test/oggvideo.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/oggvideo.htm Wed Sep 19 14:11:49 2012 +0900
@@ -7,7 +7,6 @@
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='test.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
</head>
<body>
@@ -15,7 +14,40 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- testConfig('json/ldt-ogv.json', true);
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: "json/ldt-ogv.json",
+ format: 'ldt'
+};
+var _config = {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "AutoPlayer" },
+ { type: "Sparkline" },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ { type: "CreateAnnotation" },
+ { type: "Tweet" },
+ { type: "Tagcloud" },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+};
+_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>
--- a/test/renkan.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/renkan.htm Wed Sep 19 14:11:49 2012 +0900
@@ -28,44 +28,24 @@
<div id="RenkanContainer"></div>
</div>
<script type="text/javascript">
- IriSP.libFiles.defaultDir = "libs/";
- IriSP.language = 'fr';
- IriSP.widgetsDir = "metadataplayer";
- var _metadata = {
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.language = 'fr';
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
// url: 'json/ldt-jwplayer.json',
- url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/67280b1c-ff30-11e0-a82d-00145ea49a02?callback=?',
- format: 'ldt'
- };
- var _config = {
- gui: {
- width : 550,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
- },
- css : 'metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- { type: "Polemic" },
- { type: "Segments" },
- { type: "Slice" },
- {
- type: "Arrow",
- base_height: 4
- },
- { type: "Annotation" },
- { type: "Tweet" },
- {
- type: "Renkan",
- container: "RenkanContainer",
- data: [ "json/renkan.json", "json/renkan-2.json" ]
- },
- { type: "Mediafragment"}
- ]
- },
- player:{
- type:'auto',
+ url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/67280b1c-ff30-11e0-a82d-00145ea49a02?callback=?',
+ format: 'ldt'
+};
+var _config = {
+ width : 550,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "JwpPlayer",
live: true,
height: 350,
width: 550,
@@ -77,13 +57,29 @@
} else {
return _url;
}
- },
- //autostart: true,
- metadata: _metadata
- }
- };
-
- var _myPlayer = new IriSP.Metadataplayer(_config);
+ }
+ },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ {
+ type: "Arrow",
+ base_height: 4
+ },
+ { type: "Annotation" },
+ { type: "Tweet" },
+ {
+ type: "Renkan",
+ container: "RenkanContainer",
+ data: [ "json/renkan.json", "json/renkan-2.json" ]
+ },
+ { type: "Mediafragment"}
+ ]
+};
+
+var _myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
--- a/test/slideshare.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/slideshare.htm Wed Sep 19 14:11:49 2012 +0900
@@ -7,7 +7,6 @@
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='test.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
<style type="text/css">
#SlideShareContainer {
float: left;
@@ -23,60 +22,63 @@
<div id="SlideShareContainer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- IriSP.libFiles.locations.jwPlayerSWF = "player.swf";
- IriSP.libFiles.defaultDir = "libs/";
- IriSP.language = 'fr';
- IriSP.widgetsDir = "metadataplayer";
- var _metadata = {
- url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/8a1a344a-7f34-11e1-9ee2-00145ea4a2be?callback=?',
- format: 'ldt'
- };
- var _config = {
- gui: {
- width : 620,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
- },
- css : 'metadataplayer/LdtPlayer-core.css',
- widgets: [
- { type: "Slider" },
- { type: "Controller" },
- { type: "Polemic" },
- { type: "Segments" },
- { type: "Slice" },
- { type: "Arrow" },
- { type: "Annotation" },
- {
- type: "CreateAnnotation",
- api_endpoint_template: "/pf/ldtplatform/api/ldt/annotations/{{id}}.json",
- creator_name: "Metadataplayer"
- },
- { type: "Tweet" },
- {
- type: "Tagcloud"
- },
- {
- type: "AnnotationsList",
- container: "AnnotationsListContainer"
- },
- {
- type: "Slideshare",
- container: "SlideShareContainer"
- },
- { type: "Mediafragment"}
- ]
- },
- player:{
- type:'auto',
- live: true,
- height: 350,
- width: 620,
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.language = 'fr';
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/8a1a344a-7f34-11e1-9ee2-00145ea4a2be?callback=?',
+ format: 'ldt'
+};
+var _config = {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "JwpPlayer",
+ live: true,
+ height: 350,
provider: "rtmp",
autostart: true,
- metadata: _metadata
- }
- };
+ streamer: function(_url) {
+ var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
+ if (_matches) {
+ return _matches[0];
+ } else {
+ return _url;
+ }
+ }
+ },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ {
+ type: "CreateAnnotation",
+ api_endpoint_template: "/pf/ldtplatform/api/ldt/annotations/{{id}}.json",
+ creator_name: "Metadataplayer"
+ },
+ { type: "Tweet" },
+ {
+ type: "Tagcloud"
+ },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ {
+ type: "Slideshare",
+ container: "SlideShareContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+};
var _myPlayer = new IriSP.Metadataplayer(_config);
--- a/test/test-config.js Fri Sep 14 10:38:04 2012 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-function testConfig(_urlMetadata, _useLocalBuild, _video, _playerType) {
- document.getElementById('LdtPlayer').innerHTML = '';
- _useLocalBuild = (typeof _useLocalBuild !== "undefined" && _useLocalBuild)
- IriSP.libFiles.defaultDir = _useLocalBuild ? "libs/" : "../src/js/libs/";
- IriSP.widgetsDir = _useLocalBuild ? "metadataplayer" : "../src/widgets";
- var _metadata = {
- url: _urlMetadata,
- format: 'ldt'
- };
- var _config = {
- gui: {
- width : 620,
- container : 'LdtPlayer',
- default_options: {
- metadata: _metadata
- },
- css : _useLocalBuild ? 'metadataplayer/LdtPlayer-core.css' : '../src/css/LdtPlayer-core.css',
- widgets: [
- { type: "Sparkline" },
- { type: "Slider" },
- { type: "Controller" },
- { type: "Polemic" },
- { type: "Segments" },
- { type: "Slice" },
- { type: "Arrow" },
- { type: "Annotation" },
- { type: "CreateAnnotation" },
- { type: "Tweet" },
- { type: "Tagcloud" },
- {
- type: "AnnotationsList",
- container: "AnnotationsListContainer"
- },
- { type: "Mediafragment"}
-/* {
- type: "Trace",
- default_subject: "tests-iri",
- js_console: true
- } */
- ]
- },
- player:{
- type:'auto',
- live: true,
- height: 350,
- width: 620,
- provider: "rtmp",
- autostart: true,
- metadata: _metadata
- }
- };
- if (typeof _playerType != "undefined") {
- _config.player.type = _playerType;
- }
- if (typeof _video != "undefined") {
- _config.player.video = _video;
- }
-
- return new IriSP.Metadataplayer(_config);
-}
\ No newline at end of file
--- a/test/vimeo.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/vimeo.htm Wed Sep 19 14:11:49 2012 +0900
@@ -7,7 +7,6 @@
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='test.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="metadataplayer/LdtPlayer-core.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
</head>
<body>
@@ -15,7 +14,40 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- testConfig('json/ldt-vimeo.json', true);
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: "json/ldt-vimeo.json",
+ format: 'ldt'
+};
+var _config = {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "AutoPlayer" },
+ { type: "Sparkline" },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ { type: "CreateAnnotation" },
+ { type: "Tweet" },
+ { type: "Tagcloud" },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+};
+_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>
--- a/test/youtube.htm Fri Sep 14 10:38:04 2012 +0900
+++ b/test/youtube.htm Wed Sep 19 14:11:49 2012 +0900
@@ -7,7 +7,6 @@
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='test.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="../build/LdtPlayer-core.js" type="text/javascript"></script>
- <script type="text/javascript" src="test-config.js" type="text/javascript"></script>
</head>
<body>
@@ -15,7 +14,40 @@
<div id="LdtPlayer"></div>
<div id="AnnotationsListContainer"></div>
<script type="text/javascript">
- testConfig('json/ldt-youtube.json', true);
+IriSP.libFiles.defaultDir = "libs/";
+IriSP.widgetsDir = "metadataplayer";
+var _metadata = {
+ url: "json/ldt-youtube.json",
+ format: 'ldt'
+};
+var _config = {
+ width : 620,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : 'metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ { type: "AutoPlayer" },
+ { type: "Sparkline" },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Slice" },
+ { type: "Arrow" },
+ { type: "Annotation" },
+ { type: "CreateAnnotation" },
+ { type: "Tweet" },
+ { type: "Tagcloud" },
+ {
+ type: "AnnotationsList",
+ container: "AnnotationsListContainer"
+ },
+ { type: "Mediafragment"}
+ ]
+};
+_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</body>
</html>