~cadence/tube-devel

cloudtube: Fix #14 implement video autoplay with URL parameter v1 APPLIED

~lomanic
~lomanic: 1
 Fix #14 implement video autoplay with URL parameter

 2 files changed, 3 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~cadence/tube-devel/patches/22339/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH cloudtube] Fix #14 implement video autoplay with URL parameter Export this patch

~lomanic
From: Lomanic <lomanic@hotmail.fr>

Fixes https://todo.sr.ht/~cadence/tube/14
---
 api/video.js  | 3 ++-
 pug/video.pug | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/api/video.js b/api/video.js
index ad82499..5651248 100644
--- a/api/video.js
+++ b/api/video.js
@@ -190,6 +190,7 @@ module.exports = [

			// Continuous mode
			const continuous = url.searchParams.get("continuous") === "1"
			const autoplay = url.searchParams.get("autoplay") === "1"
			const swp = url.searchParams.get("session-watched")
			const sessionWatched = swp ? swp.split(" ") : []
			const sessionWatchedNext = sessionWatched.concat([id]).join("+")
@@ -210,7 +211,7 @@ module.exports = [
			return renderVideo(video, {
				user, settings, id, instanceOrigin
			}, {
				mediaFragment, continuous, sessionWatched, sessionWatchedNext
				mediaFragment, autoplay, continuous, sessionWatched, sessionWatchedNext
			})
		}
	}
diff --git a/pug/video.pug b/pug/video.pug
index bfdd301..df3e00d 100644
--- a/pug/video.pug
+++ b/pug/video.pug
@@ -24,7 +24,7 @@ block content
        .video-container
          - const format = formats[0]
          if format
            video(controls preload="auto" width=format.second__width height=format.second__height data-itag=format.itag autoplay=continuous)#video.video
            video(controls preload="auto" width=format.second__width height=format.second__height data-itag=format.itag autoplay=continuous||autoplay)#video.video
              source(src=format.url+mediaFragment type=format.type)
              each t in video.captions
                track(label=t.label kind="subtitles" srclang=t.languageCode src=t.url)
-- 
2.30.2
Patch applied - but note that autoplay does not work with DASH
playback, at least not at the moment. I'd prefer to fix DASH rather
than having autoplay restrict the quality selection like continuous
mode does.