Skip to content

Commit

Permalink
πŸ› [Story video] Added check on buffer before downgrading (#33634)
Browse files Browse the repository at this point in the history
* Added check on buffer before downgrading

* Added comment

* 0.99 for threshold
  • Loading branch information
mszylkowski committed Apr 19, 2021
1 parent 984907c commit ea686db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/amp-video/0.1/flexible-bitrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ export class BitrateManager {
*/
function onNontrivialWait(video, callback) {
listen(video, 'waiting', () => {
// Do not trigger downgrade if not loaded metadata yet.
if (video.readyState < 1) {
// Do not trigger downgrade if not loaded metadata yet, or if video is fully loaded (eg: replay).
if (video.readyState < 1 || getBufferedPercentage(video) > 0.99) {
return;
}
let timer = null;
Expand Down

0 comments on commit ea686db

Please sign in to comment.