From 3bdf2cfb1482feb6569529fd60ba89f7937cc607 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Thu, 8 Dec 2022 18:07:02 -0500 Subject: [PATCH] Autoplay next video --- CHANGELOG.md | 2 ++ src/components/VideoPlayer/VideoPlayer.bs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e56008ff..c31f2536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - The License has changed from MIT to AGPL +- Now videos play the next related/recommended video once finished + - This does not take into account the videos in playlists ### Fixed - Bug where app freezes if metadata fails to fetch diff --git a/src/components/VideoPlayer/VideoPlayer.bs b/src/components/VideoPlayer/VideoPlayer.bs index 668fc15e..addd90f9 100644 --- a/src/components/VideoPlayer/VideoPlayer.bs +++ b/src/components/VideoPlayer/VideoPlayer.bs @@ -228,7 +228,13 @@ function OnVideoPlayerStateChange() as void end if if state = "finished" - CloseVideo() + metadata = m.top.content?.metadata + videoId = metadata?.recommendedVideos?[0]?.videoId + if videoId <> invalid + PlayVideo(videoId, invalid) + else + CloseVideo() + end if end if if state = "error"