From a762e65a756870821c67a5dda8aad514845ec9b1 Mon Sep 17 00:00:00 2001 From: candry7731 <83685828+candry7731@users.noreply.github.com> Date: Sun, 20 Nov 2022 23:43:20 -0600 Subject: [PATCH] added api to check is next episode is valid --- components/JFVideo.brs | 10 ++++++++++ components/JFVideo.xml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/components/JFVideo.brs b/components/JFVideo.brs index 20f3c7a2..756f9498 100644 --- a/components/JFVideo.brs +++ b/components/JFVideo.brs @@ -22,11 +22,13 @@ sub init() m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton") m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton") + end sub ' Event handler for when video content field changes sub onContentChange() m.top.observeField("position", "onPositionChanged") + 'check if episode has a next episode ' If video content type is not episode, remove position observer if m.top.content.contenttype <> 4 @@ -107,6 +109,14 @@ sub onState(msg) m.top.control = "stop" m.top.backPressed = true else if m.top.state = "playing" + params = { "UserId": get_setting("active_user"), "adjacentTo": m.top.id } + series = m.top.showID + nextEpisode = api_API().shows.getepisodes(series, params) + print nextEpisode + if isValid(nextEpisode) + print nextEpisode + end if + if m.playReported = false ReportPlayback("start") m.playReported = true diff --git a/components/JFVideo.xml b/components/JFVideo.xml index bcd593c7..3d444f16 100644 --- a/components/JFVideo.xml +++ b/components/JFVideo.xml @@ -27,6 +27,8 @@