Skip to content

Commit 3a97e47

Browse files
Merge pull request #102 from bbc/video-not-advancing-updates
Video Frames Not Advancing, check for start and end of video
2 parents f17dd7a + f2cb69b commit 3a97e47

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/streaming/controllers/StreamController.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,20 @@ function StreamController() {
805805

806806
const playbackQuality = videoModel.getPlaybackQuality();
807807

808+
if(videoModel.isSeeking()){
809+
totalVideoFramesAtLastPlaybackProgress = 0
810+
}
811+
812+
const isEnded = event.timeToEnd ? event.timeToEnd >= 0 : false;
813+
808814
const isVideoFramesNotAdvancing = playbackQuality &&
809815
typeof playbackQuality.totalVideoFrames === 'number'
816+
&& !isEnded
810817
&& timeAtLastPlaybackProgress !== 0
818+
&& event.time > settings.get().streaming.buffer.videoFramesNotAdvancing.thresholdInSeconds // We should be at least one threshold into the video before triggering
811819
&& !videoModel.isPaused()
812820
&& !videoModel.isStalled()
821+
&& !videoModel.isSeeking()
813822
&& videoModel.getReadyState() >= Constants.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA
814823
&& playbackQuality.totalVideoFrames > 0 // Handles devices (some TVs), where Video Quality API, totalVideoFrames always returns 0.
815824
&& playbackQuality.totalVideoFrames < 2147483647 //Handles devices (some WebKit TVs), where Video Quality API, totalVideoFrames can return the max value of a 32 bit signed integer becuase the implementation uses totalVideoFrames = mediaTime * framerate.
@@ -818,7 +827,13 @@ function StreamController() {
818827

819828
if(isVideoFramesNotAdvancing){
820829
if((timeAtLastPlaybackProgress + settings.get().streaming.buffer.videoFramesNotAdvancing.thresholdInSeconds < event.time) && !videoFramesNotAdvancingTriggered){
821-
eventBus.trigger(Events.PLAYBACK_FROZEN,{cause:'Frames have stopped advancing, Chromium bug #41243192', totalVideoFrames: playbackQuality.totalVideoFrames, time: event.time });
830+
eventBus.trigger(Events.PLAYBACK_FROZEN,{
831+
cause:'Frames have stopped advancing, Chromium bug #41243192',
832+
totalVideoFrames: playbackQuality.totalVideoFrames,
833+
mediaTime: event.time,
834+
isEnded: videoModel.getEnded(),
835+
isSeeking: videoModel.isSeeking()
836+
});
822837
if(settings.get().streaming.buffer.videoFramesNotAdvancing.enabled){
823838
logger.warn('Video playback has frozen, attempting to recover by seeking to current time')
824839
videoModel.setCurrentTime(videoModel.getTime()-0.0001,false)

0 commit comments

Comments
 (0)