src/widgets/AdaptivePlayer.js
author durandn
Tue, 01 Sep 2015 15:31:46 +0200
changeset 1046 eb77616c245f
parent 1042 a128e59ca2b1
child 1072 ac1eacb3aa33
permissions -rw-r--r--
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea

IriSP.Widgets.AdaptivePlayer = function(player, config) {
    IriSP.Widgets.Widget.call(this, player, config);
};

IriSP.Widgets.AdaptivePlayer.prototype = new IriSP.Widgets.Widget();

IriSP.Widgets.AdaptivePlayer.prototype.defaults = {
    mime_type: 'video/mp4; codecs="avc1.42E01E"',
    normal_player: "HtmlPlayer",
    fallback_player: "JwpPlayer"
};

IriSP.Widgets.AdaptivePlayer.prototype.draw = function() {
    
    if (typeof this.video === "undefined") {
        this.video = this.media.video;
    }
    
    var _props = [ "autostart", "video", "height", "width", "url_transform" ],
        _opts = {},
        _canPlayType = document.createElement('video').canPlayType(this.mime_type);
    
    _opts.type = (_canPlayType !== "no") ? this.normal_player : this.fallback_player;
    
    for (var i = 0; i < _props.length; i++) {
        if (typeof this[_props[i]] !== "undefined") {
            _opts[_props[i]] = this[_props[i]];
        }
    }

    this.insertSubwidget(this.$, _opts);
    
};