integration/js/mashupcore.js
changeset 154 60ca7678f074
parent 149 f2daa65fcab6
equal deleted inserted replaced
153:0b710028f3d3 154:60ca7678f074
    10             var vizdata = {
    10             var vizdata = {
    11                 left: k * t,
    11                 left: k * t,
    12                 width: k * _s.duration,
    12                 width: k * _s.duration,
    13                 color: _s.color,
    13                 color: _s.color,
    14                 segmentid: _s.annotation.id
    14                 segmentid: _s.annotation.id
    15             }
    15             };
    16             vizhtml += viztemplate(vizdata);
    16             vizhtml += viztemplate(vizdata);
    17             t += _s.duration.milliseconds;
    17             t += _s.duration.milliseconds;
    18         });
    18         });
    19         
    19         
    20         var intervals = [ 1000, 2000, 5000, 10000, 30000, 60000, 120000, 300000, 600000, 900000, 1800000, 3600000, 7200000 ];
    20         var intervals = [ 1000, 2000, 5000, 10000, 30000, 60000, 120000, 300000, 600000, 900000, 1800000, 3600000, 7200000 ];
   146     function calculateHandleCss(_size) {
   146     function calculateHandleCss(_size) {
   147         return {
   147         return {
   148             height: (2 + _size) + "px",
   148             height: (2 + _size) + "px",
   149             width: (2 + _size) + "px",
   149             width: (2 + _size) + "px",
   150             "margin-left": -Math.ceil(2 + _size / 2) + "px" 
   150             "margin-left": -Math.ceil(2 + _size / 2) + "px" 
   151         }
   151         };
   152     }
   152     }
   153     
   153     
   154     /* Controller Widget */
   154     /* Controller Widget */
   155    
   155    
   156     var volBlock = $(".Ldt-Ctrl-Volume-Control");
   156     var volBlock = $(".Ldt-Ctrl-Volume-Control");
   187             if (_muted) {        
   187             if (_muted) {        
   188                 _soundCtl.attr("title", gettext("Unmute"))
   188                 _soundCtl.attr("title", gettext("Unmute"))
   189                     .addClass("Ldt-Ctrl-Sound-Mute");    
   189                     .addClass("Ldt-Ctrl-Sound-Mute");    
   190             } else {
   190             } else {
   191                 _soundCtl.attr("title", gettext("mute"))
   191                 _soundCtl.attr("title", gettext("mute"))
   192                     .addClass(_vol < .5 ? "Ldt-Ctrl-Sound-Half" : "Ldt-Ctrl-Sound-Full" )
   192                     .addClass(_vol < .5 ? "Ldt-Ctrl-Sound-Half" : "Ldt-Ctrl-Sound-Full" );
   193             }
   193             }
   194             volBar.slider("value", _muted ? 0 : 100 * _vol);
   194             volBar.slider("value", _muted ? 0 : 100 * _vol);
   195             volBar.attr("title",gettext("Volume:") + Math.floor(100 * _vol) + '%');
   195             volBar.attr("title",gettext("Volume:") + Math.floor(100 * _vol) + '%');
   196         }
   196         }
   197     }
   197     }
   218 
   218 
   219     function onCurrentMediaPlay() {
   219     function onCurrentMediaPlay() {
   220         $(".Ldt-Ctrl-Play")
   220         $(".Ldt-Ctrl-Play")
   221             .attr("title", gettext("Pause"))
   221             .attr("title", gettext("Pause"))
   222             .removeClass("Ldt-Ctrl-Play-PlayState")
   222             .removeClass("Ldt-Ctrl-Play-PlayState")
   223             .addClass("Ldt-Ctrl-Play-PauseState")
   223             .addClass("Ldt-Ctrl-Play-PauseState");
   224     }
   224     }
   225     
   225     
   226     function onCurrentMediaPause() {
   226     function onCurrentMediaPause() {
   227         $(".Ldt-Ctrl-Play")
   227         $(".Ldt-Ctrl-Play")
   228             .attr("title", gettext("Play"))
   228             .attr("title", gettext("Play"))
   229             .removeClass("Ldt-Ctrl-Play-PauseState")
   229             .removeClass("Ldt-Ctrl-Play-PauseState")
   230             .addClass("Ldt-Ctrl-Play-PlayState")
   230             .addClass("Ldt-Ctrl-Play-PlayState");
   231     }
   231     }
   232     
   232     
   233     function onCurrentMediaTimeupdate(_time) {
   233     function onCurrentMediaTimeupdate(_time) {
   234         $(".Ldt-Ctrl-Time-Elapsed").text(_time.toString());
   234         $(".Ldt-Ctrl-Time-Elapsed").text(_time.toString());
   235         timeSlider.slider("value",slidersRange * _time / currentMedia.duration);
   235         timeSlider.slider("value",slidersRange * _time / currentMedia.duration);
   352             videoSelector.on("loadedmetadata", function() {
   352             videoSelector.on("loadedmetadata", function() {
   353                 getVolume();
   353                 getVolume();
   354                 media.loaded = true;
   354                 media.loaded = true;
   355                 media.trigger("loadedmetadata");
   355                 media.trigger("loadedmetadata");
   356                 media.trigger("volumechange");
   356                 media.trigger("volumechange");
   357             })
   357             });
   358             
   358             
   359             videoSelector.on("timeupdate", function() {
   359             videoSelector.on("timeupdate", function() {
   360                 media.trigger("timeupdate", new IriSP.Model.Time(1000*videoElement.currentTime));
   360                 media.trigger("timeupdate", new IriSP.Model.Time(1000*videoElement.currentTime));
   361             });
   361             });
   362             
   362             
   363             videoSelector.on("volumechange", function() {
   363             videoSelector.on("volumechange", function() {
   364                 getVolume();
   364                 getVolume();
   365                 media.trigger("volumechange");
   365                 media.trigger("volumechange");
   366             })
   366             });
   367             
   367             
   368             videoSelector.on("play", function() {
   368             videoSelector.on("play", function() {
   369                 media.trigger("play");
   369                 media.trigger("play");
   370             });
   370             });
   371             
   371             
   378             });
   378             });
   379             
   379             
   380             videoSelector.on("seeked", function() {
   380             videoSelector.on("seeked", function() {
   381                 media.trigger("seeked");
   381                 media.trigger("seeked");
   382             });
   382             });
   383         }
   383         };
   384         
   384         
   385         media.hide = function() {
   385         media.hide = function() {
   386             $("#" + videoid).remove();
   386             $("#" + videoid).remove();
   387         }
   387         };
   388         
   388         
   389         // Binding functions to Media Element Functions
   389         // Binding functions to Media Element Functions
   390                 
   390                 
   391         media.on("setcurrenttime", function(_milliseconds) {
   391         media.on("setcurrenttime", function(_milliseconds) {
   392             try {
   392             try {
   561         }
   561         }
   562     });
   562     });
   563     
   563     
   564     mashup.on("add", function() {
   564     mashup.on("add", function() {
   565         mashup.getMedias().forEach(addMedia);
   565         mashup.getMedias().forEach(addMedia);
   566     })
   566     });
   567     
   567     
   568     mashup.on("change",updateMashupUI);
   568     mashup.on("change",updateMashupUI);
   569     
   569     
   570     mashup.on("enter-annotation", function(segment) {
   570     mashup.on("enter-annotation", function(segment) {
   571         var a = segment.annotation;
   571         var a = segment.annotation;
   608         var segment = mashup.getAnnotation(annotation);
   608         var segment = mashup.getAnnotation(annotation);
   609         project.trigger("set-current", mashup);
   609         project.trigger("set-current", mashup);
   610         if (segment) {
   610         if (segment) {
   611             mashup.setCurrentTime(segment.begin);
   611             mashup.setCurrentTime(segment.begin);
   612         }
   612         }
   613     })
   613     });
   614     
   614     
   615     project.on("set-current", function(media) {
   615     project.on("set-current", function(media) {
   616         currentMedia = media;
   616         currentMedia = media;
   617         if (currentMedia.elementType === "media") {
   617         if (currentMedia.elementType === "media") {
   618             if (!media.has_player) {
   618             if (!media.has_player) {
   648         mouseoverSegment = segment;
   648         mouseoverSegment = segment;
   649     })
   649     })
   650     .mouseleave(function() {
   650     .mouseleave(function() {
   651         project.trigger("mouseout-annotation");
   651         project.trigger("mouseout-annotation");
   652         mouseoverSegment = undefined;
   652         mouseoverSegment = undefined;
   653     })
   653     });
   654     
   654     
   655     mashup.trigger("add");
   655     mashup.trigger("add");
   656     
   656     
   657 }
   657 };
   658 
   658 
   659 /* END mashupcore.js */
   659 /* END mashupcore.js */
   660 
   660