src/widgets/JwpPlayer.js
changeset 1005 768bd0691ed1
parent 987 7b65bf78873a
child 1007 639129cf95bc
equal deleted inserted replaced
1004:cf0f2339169e 1005:768bd0691ed1
    10 IriSP.Widgets.JwpPlayer.prototype.draw = function() {
    10 IriSP.Widgets.JwpPlayer.prototype.draw = function() {
    11     
    11     
    12     var _opts = {},
    12     var _opts = {},
    13         _player = jwplayer(this.$[0]),
    13         _player = jwplayer(this.$[0]),
    14         _seekPause = false,
    14         _seekPause = false,
    15         _pauseState = true,
    15         _pauseState = true;
    16         _props = [ "live", "provider", "autostart" ];
       
    17     
    16     
    18     if (typeof this.video === "undefined") {
    17     if (typeof this.video === "undefined") {
    19         this.video = this.media.video;
    18         this.video = this.media.video;
    20     }
    19     }
    21     
       
    22     if (typeof this.streamer === "undefined") {
       
    23         this.streamer = this.media.streamer;
       
    24     }
       
    25     
       
    26     if (typeof this.streamer === "function") {
       
    27         this.streamer = this.streamer(this.video);
       
    28     }
       
    29 
       
    30     if (typeof this.streamer === "string" && (this.provider === "http" || this.provider === "rtmp")) {
       
    31         this.video = this.video.replace(this.streamer,"");
       
    32         _opts.streamer = this.streamer;
       
    33     }
       
    34         
    20         
    35     _opts.file = this.video;
    21     _opts.file = this.video;
    36     _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
    22     _opts.flashplayer = IriSP.getLib("jwPlayerSWF");
    37     _opts["controlbar.position"] = "none";
    23     _opts.primary = "flash";
       
    24     _opts.fallback = false;
       
    25     _opts.controls = false;
    38     _opts.width = this.width;
    26     _opts.width = this.width;
    39     if (this.height) {
    27     if (this.height) {
    40         _opts.height = this.height;
    28         _opts.height = this.height;
    41     }
    29     }
    42     
    30     
    43     for (var i = 0; i < _props.length; i++) {
    31     if (this.autostart) { // There seems to be an autostart bug
    44         if (typeof this[_props[i]] !== "undefined") {
    32         //_opts.autostart = true;
    45             _opts[_props[i]] = this[_props[i]];
    33         //_pauseState = false;
    46         }
    34         //this.media.trigger("play");
    47     }
       
    48     
       
    49     if (this.autostart) {
       
    50         _pauseState = false;
       
    51         this.media.trigger("play");
       
    52     }
    35     }
    53 
    36 
    54     // Binding functions to jwplayer
    37     // Binding functions to jwplayer
    55 
    38 
    56     var _media = this.media;
    39     var _media = this.media;
   125         onVolume: function(_event) {
   108         onVolume: function(_event) {
   126             _media.volume = _event.volume / 100;
   109             _media.volume = _event.volume / 100;
   127             _media.trigger("volumechange");
   110             _media.trigger("volumechange");
   128         }
   111         }
   129     }
   112     }
   130     _player.setup(_opts);
   113     
       
   114     _player = _player.setup(_opts);
   131     
   115     
   132     this.jwplayer = _player;
   116     this.jwplayer = _player;
   133     
   117     
   134 }
   118 }