Skip to content

Commit 4bb6804

Browse files
Merge pull request #104 from bbc/video-frames-not-advancing-ignore-webkit
Check if device isWebKit when using videoFramesNotAdvancing
2 parents 5948e1d + 8c10911 commit 4bb6804

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/streaming/controllers/StreamController.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,14 @@ function StreamController() {
797797
}
798798
}
799799

800+
/**
801+
* Checks whether the browser environment is WebKit based or not
802+
* @private
803+
*/
804+
function isWebKit() {
805+
return typeof window.webkitConvertPointFromNodeToPage === 'function' || false
806+
}
807+
800808
/**
801809
* Evaluates whether video frames have potentially stopped advancing, added to address https://issues.chromium.org/issues/41243192
802810
* @private
@@ -811,8 +819,9 @@ function StreamController() {
811819

812820
const isEnded = event.timeToEnd ? event.timeToEnd <= 0 : false;
813821

814-
const isVideoFramesNotAdvancing = playbackQuality &&
815-
typeof playbackQuality.totalVideoFrames === 'number'
822+
const isVideoFramesNotAdvancing = !isWebKit()
823+
&& playbackQuality
824+
&& typeof playbackQuality.totalVideoFrames === 'number'
816825
&& !isEnded
817826
&& timeAtLastPlaybackProgress !== 0
818827
&& event.time > settings.get().streaming.buffer.videoFramesNotAdvancing.thresholdInSeconds // We should be at least one threshold into the video before triggering
@@ -821,18 +830,16 @@ function StreamController() {
821830
&& !videoModel.isSeeking()
822831
&& videoModel.getReadyState() >= Constants.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA
823832
&& playbackQuality.totalVideoFrames > 0 // Handles devices (some TVs), where Video Quality API, totalVideoFrames always returns 0.
824-
&& 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.
833+
&& playbackQuality.totalVideoFrames < 2147483647 //Handles devices, where Video Quality API, totalVideoFrames can return the max value of a 32 bit signed integer becuase the implementation uses totalVideoFrames = mediaTime * framerate.
825834
&& playbackQuality.totalVideoFrames !== playbackQuality.droppedVideoFrames // Handles devices (some TVs), where Video Quality API, totalVideoFrames always equals the number of dropped frames.
826-
&& playbackQuality.totalVideoFrames === totalVideoFramesAtLastPlaybackProgress // Total frames should advance with time progression, if not something is wrong. On some some WebKit TVs the total video frames is reset if the decoder is reinitialised.
835+
&& playbackQuality.totalVideoFrames === totalVideoFramesAtLastPlaybackProgress // Total frames should advance with time progression, if not something is wrong. On some some TVs the total video frames is reset if the decoder is reinitialised.
827836

828837
if(isVideoFramesNotAdvancing){
829838
if((timeAtLastPlaybackProgress + settings.get().streaming.buffer.videoFramesNotAdvancing.thresholdInSeconds < event.time) && !videoFramesNotAdvancingTriggered){
830839
eventBus.trigger(Events.PLAYBACK_FROZEN,{
831840
cause:'Frames have stopped advancing, Chromium bug #41243192',
832841
totalVideoFrames: playbackQuality.totalVideoFrames,
833-
mediaTime: event.time,
834-
isEnded: videoModel.getEnded(),
835-
isSeeking: videoModel.isSeeking()
842+
mediaTime: event.time
836843
});
837844
if(settings.get().streaming.buffer.videoFramesNotAdvancing.enabled){
838845
logger.warn('Video playback has frozen, attempting to recover by seeking to current time')

0 commit comments

Comments
 (0)