From 7a6d4e6ef9c2c834c61fa78e6c0a8d59d3ce18b4 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 8 Nov 2018 08:37:48 -0600 Subject: [PATCH] Add extra handling for autoplay --- src/invidious/views/watch.ecr | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index b4247fd4..8b225ec6 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -275,6 +275,28 @@ function get_playlist() { get_playlist(); <% end %> +<% if params[:autoplay] %> +var bpb = player.getChild('bigPlayButton'); + +if (bpb) { + bpb.hide(); + + player.ready(function() { + var promise = player.play(); + + if (promise === undefined) { + bpb.show(); + } else { + promise.then(function() { + bpb.show(); + }, function() { + bpb.show(); + }); + } + }); +} +<% end %> + function get_reddit_comments() { comments = document.getElementById("comments"); var fallback = comments.innerHTML;