Embed: mews: fixes seek loop *knock on wood*
This commit is contained in:
parent
4efeb06c1d
commit
ac54fef930
2 changed files with 27 additions and 28 deletions
File diff suppressed because one or more lines are too long
|
@ -102,6 +102,7 @@ p.prototype.build = function (MistVideo,callback) {
|
||||||
|
|
||||||
var player = this;
|
var player = this;
|
||||||
//player.debugging = true;
|
//player.debugging = true;
|
||||||
|
//player.debugging = "dl"; //download appended data on ms close
|
||||||
|
|
||||||
//this function is called both when the websocket is ready and the media source is ready - both should be open to proceed
|
//this function is called both when the websocket is ready and the media source is ready - both should be open to proceed
|
||||||
function checkReady() {
|
function checkReady() {
|
||||||
|
@ -129,32 +130,30 @@ p.prototype.build = function (MistVideo,callback) {
|
||||||
player.ms.onsourceended = function(e){
|
player.ms.onsourceended = function(e){
|
||||||
if (player.debugging) console.error("ms ended",e);
|
if (player.debugging) console.error("ms ended",e);
|
||||||
|
|
||||||
//for debugging
|
if (player.debugging == "dl") {
|
||||||
|
function downloadBlob (data, fileName, mimeType) {
|
||||||
|
var blob, url;
|
||||||
|
blob = new Blob([data], {
|
||||||
|
type: mimeType
|
||||||
|
});
|
||||||
|
url = window.URL.createObjectURL(blob);
|
||||||
|
downloadURL(url, fileName);
|
||||||
|
setTimeout(function() {
|
||||||
|
return window.URL.revokeObjectURL(url);
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
function downloadBlob (data, fileName, mimeType) {
|
function downloadURL (data, fileName) {
|
||||||
var blob, url;
|
var a;
|
||||||
blob = new Blob([data], {
|
a = document.createElement('a');
|
||||||
type: mimeType
|
a.href = data;
|
||||||
});
|
a.download = fileName;
|
||||||
url = window.URL.createObjectURL(blob);
|
document.body.appendChild(a);
|
||||||
downloadURL(url, fileName);
|
a.style = 'display: none';
|
||||||
setTimeout(function() {
|
a.click();
|
||||||
return window.URL.revokeObjectURL(url);
|
a.remove();
|
||||||
}, 1000);
|
};
|
||||||
};
|
|
||||||
|
|
||||||
function downloadURL (data, fileName) {
|
|
||||||
var a;
|
|
||||||
a = document.createElement('a');
|
|
||||||
a.href = data;
|
|
||||||
a.download = fileName;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.style = 'display: none';
|
|
||||||
a.click();
|
|
||||||
a.remove();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (player.debugging) {
|
|
||||||
var l = 0;
|
var l = 0;
|
||||||
for (var i = 0; i < player.sb.appended.length; i++) {
|
for (var i = 0; i < player.sb.appended.length; i++) {
|
||||||
l += player.sb.appended[i].length;
|
l += player.sb.appended[i].length;
|
||||||
|
@ -906,8 +905,8 @@ p.prototype.build = function (MistVideo,callback) {
|
||||||
value = (e.data.current*1e-3).toFixed(3);
|
value = (e.data.current*1e-3).toFixed(3);
|
||||||
var f = function() {
|
var f = function() {
|
||||||
video.currentTime = value;
|
video.currentTime = value;
|
||||||
if (video.currentTime != value) {
|
if (video.currentTime.toFixed(3) != value) {
|
||||||
if (player.debugging) console.log("Failed to set video.currentTime, wanted:",value,"got:",video.currentTime);
|
MistVideo.log("Failed to seek, wanted:",value,"got:",video.currentTime.toFixed(3));
|
||||||
player.sb._doNext(f);
|
player.sb._doNext(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue