Skip to content

Commit

Permalink
Merge remote-tracking branch 'dailymotion/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Dec 7, 2015
2 parents 0ee8eaf + ca828c3 commit b8fa293
Show file tree
Hide file tree
Showing 16 changed files with 241 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"globals" : {
"console" : true,
"MediaSource" : true,
"performance" : true
"performance" : true,
"crypto" : true
}
}
4 changes: 2 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ This allows user to easily modify/setup XHR. see example below.
```js
var config = {
xhrSetup: function(xhr) {
xhrSetup: function(xhr, url) {
xhr.withCredentials = true; // do send cookies
}
}
Expand All @@ -366,7 +366,7 @@ calling this method will :
- create MediaSource and set it as video source
- once MediaSource object is successfully created, MSE_ATTACHED event will be fired.
#### ```hls.detachVideo()```
#### ```hls.detachMedia()```
calling this method will :
- unbind VideoElement from hls instance,
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hls.js",
"version": "0.3.4",
"version": "0.3.5",
"description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js",
"authors": [
Expand Down
25 changes: 19 additions & 6 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ <h4> Stats Display </h4>
$('#metricsButtonWindow').toggle(windowSliding);
$('#metricsButtonFixed').toggle(!windowSliding);
$('#enableStream').click(function() { enableStreaming = this.checked; loadStream($('#streamURL').val());});
$('#autoRecoverError').prop( "checked", false );
$('#autoRecoverError').prop( "checked", true );
$('#autoRecoverError').click(function() { autoRecoverError = this.checked; });
});

'use strict';
var hls,events, stats, enableStreaming = true, autoRecoverError = false;
var hls,events, stats, enableStreaming = true, autoRecoverError = true;
var video = $('#video')[0];
video.volume = 0.05;

Expand Down Expand Up @@ -242,6 +242,7 @@ <h4> Stats Display </h4>

$("#HlsStatus").text('loading ' + url);
events = { url : url, t0 : performance.now(), load : [], buffer : [], video : [], level : [], bitrate : []};
recoverDecodingErrorDate = null;
hls = new Hls({debug:true});
$("#HlsStatus").text('loading manifest and attaching video element...');
hls.loadSource(url);
Expand Down Expand Up @@ -461,8 +462,14 @@ <h4> Stats Display </h4>
switch(data.type) {
case Hls.ErrorTypes.MEDIA_ERROR:
if(autoRecoverError) {
$("#HlsStatus").append(",try to recover media Error ...");
hls.recoverMediaError();
var now = performance.now();
if(!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
recoverDecodingErrorDate = performance.now();
$("#HlsStatus").append(",try to recover media Error ...");
hls.recoverMediaError();
} else {
$("#HlsStatus").append(",cannot recover, last media error recovery failed ...");
}
}
break;
case Hls.ErrorTypes.NETWORK_ERROR:
Expand Down Expand Up @@ -568,8 +575,14 @@ <h4> Stats Display </h4>
case mediaError.MEDIA_ERR_DECODE:
errorTxt = "The video playback was aborted due to a corruption problem or because the video used features your browser did not support";
if(autoRecoverError) {
errorTxt+=",try to recover video Error";
hls.recoverMediaError();
var now = performance.now();
if(!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
recoverDecodingErrorDate = performance.now();
$("#HlsStatus").append(",try to recover media Error ...");
hls.recoverMediaError();
} else {
$("#HlsStatus").append(",cannot recover, last media error recovery failed ...");
}
}
break;
case mediaError.MEDIA_ERR_NETWORK:
Expand Down
136 changes: 110 additions & 26 deletions dist/hls.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions dist/hls.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/hls.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hls.js",
"version": "0.3.4",
"version": "0.3.5",
"description": "Media Source Extension - HLS library, by/for Dailymotion",
"homepage": "https://github.com/dailymotion/hls.js",
"authors": "Guillaume du Pontavice <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/controller/level-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LevelController {
}
var redundantLevelId = bitrateSet[level.bitrate];
if (redundantLevelId === undefined) {
bitrateSet[level.bitrate] = levels.length;
bitrateSet[level.bitrate] = levels0.length;
level.url = [level.url];
level.urlId = 0;
levels0.push(level);
Expand Down
Loading

0 comments on commit b8fa293

Please sign in to comment.