Skip to content

Commit

Permalink
update video player
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed May 10, 2017
1 parent b75bdb1 commit ed105e7
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions htmlvideoplayer/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
var videoDialog;
var currentSrc;
var started = false;
var timeUpdated = false;
var hlsPlayer;

var winJsPlaybackItem;
Expand Down Expand Up @@ -124,6 +125,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
}

started = false;
timeUpdated = false;

_currentTime = null;

Expand Down Expand Up @@ -740,6 +742,11 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
// Get the player position + the transcoding offset
var time = this.currentTime;

if (time && !timeUpdated) {
timeUpdated = true;
ensureValidVideo(this);
}

_currentTime = time;
var timeMs = time * 1000;
timeMs += ((currentPlayOptions.transcodingOffsetTicks || 0) / 10000);
Expand Down Expand Up @@ -789,30 +796,25 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa

loading.hide();

ensureValidVideo(this);
} else {
events.trigger(self, 'unpause');
}
events.trigger(self, 'playing');
}

function ensureValidVideo(elem) {
setTimeout(function () {

if (elem !== mediaElement) {
return;
}

if (elem.videoWidth === 0 && elem.videoHeight === 0) {
onErrorInternal('mediadecodeerror');
return;
}
if (elem !== mediaElement) {
return;
}

//if (elem.audioTracks && !elem.audioTracks.length) {
// onErrorInternal('mediadecodeerror');
//}
if (elem.videoWidth === 0 && elem.videoHeight === 0) {
onErrorInternal('mediadecodeerror');
return;
}

}, 100);
//if (elem.audioTracks && !elem.audioTracks.length) {
// onErrorInternal('mediadecodeerror');
//}
}

function seekOnPlaybackStart(element) {
Expand Down

0 comments on commit ed105e7

Please sign in to comment.