use mediasource for source
Showing
1 changed file
with
13 additions
and
6 deletions
... | @@ -178,7 +178,7 @@ var | ... | @@ -178,7 +178,7 @@ var |
178 | * Initializes the HLS plugin. | 178 | * Initializes the HLS plugin. |
179 | * @param options {mixed} the URL to an HLS playlist | 179 | * @param options {mixed} the URL to an HLS playlist |
180 | */ | 180 | */ |
181 | init = function(options) { | 181 | init = function(options, ready) { |
182 | var | 182 | var |
183 | mediaSource = new videojs.MediaSource(), | 183 | mediaSource = new videojs.MediaSource(), |
184 | segmentParser = new videojs.Hls.SegmentParser(), | 184 | segmentParser = new videojs.Hls.SegmentParser(), |
... | @@ -535,18 +535,25 @@ var | ... | @@ -535,18 +535,25 @@ var |
535 | //if (player.options().autoplay) { | 535 | //if (player.options().autoplay) { |
536 | //player.play(); | 536 | //player.play(); |
537 | //} | 537 | //} |
538 | |||
539 | var source = options.source; | ||
540 | options.source = [{ | ||
541 | src: videojs.URL.createObjectURL(mediaSource), | ||
542 | type: "video/flv" | ||
543 | }]; | ||
544 | //delete options.source; | ||
545 | //console.log(options.source); | ||
546 | videojs.Flash.call(videojs.Hls, player, options, ready); | ||
547 | options.source = source; | ||
548 | console.log(options.source); | ||
538 | }; | 549 | }; |
539 | 550 | ||
540 | var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i; | 551 | var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i; |
541 | 552 | ||
542 | videojs.Hls = videojs.Flash.extend({ | 553 | videojs.Hls = videojs.Flash.extend({ |
543 | init: function(player, options, ready) { | 554 | init: function(player, options, ready) { |
544 | videojs.Flash.call(this, player, options, ready); | ||
545 | player.hls = {}; | 555 | player.hls = {}; |
546 | this.ready(function() { | 556 | init.call(player, options, ready); |
547 | console.log('ready!'); | ||
548 | //init.call(player, options); | ||
549 | }); | ||
550 | } | 557 | } |
551 | }); | 558 | }); |
552 | 559 | ... | ... |
-
Please register or sign in to post a comment