Skip to content

Commit 3b7f7d7

Browse files
committed
Remove "unobserve position" in JFVideo
JFVideo now always observes position. "Next Episode" button is displayed only if content type is "episode"
1 parent 15a25b1 commit 3b7f7d7

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

components/JFVideo.brs

+20-19
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,26 @@ sub onContentChange()
6868
m.top.observeField("position", "onPositionChanged")
6969

7070
' If video content type is not episode, remove position observer
71-
if m.top.content.contenttype <> 4
72-
m.top.unobserveField("position")
73-
end if
71+
' if m.top.content.contenttype <> 4
72+
' m.top.unobserveField("position")
73+
' end if
7474
end sub
7575

7676
sub onNextEpisodeDataLoaded()
7777
m.checkedForNextEpisode = true
7878

7979
m.top.observeField("position", "onPositionChanged")
80-
81-
if m.getNextEpisodeTask.nextEpisodeData.Items.count() <> 2
82-
m.top.unobserveField("position")
83-
end if
8480
end sub
8581

8682
'
8783
' Runs Next Episode button animation and sets focus to button
8884
sub showNextEpisodeButton()
89-
if not m.nextEpisodeButton.visible
90-
m.showNextEpisodeButtonAnimation.control = "start"
91-
m.nextEpisodeButton.setFocus(true)
92-
m.nextEpisodeButton.visible = true
85+
if m.top.content.contenttype = 4
86+
if not m.nextEpisodeButton.visible
87+
m.showNextEpisodeButtonAnimation.control = "start"
88+
m.nextEpisodeButton.setFocus(true)
89+
m.nextEpisodeButton.visible = true
90+
end if
9391
end if
9492
end sub
9593

@@ -109,15 +107,18 @@ end sub
109107

110108
' Checks if we need to display the Next Episode button
111109
sub checkTimeToDisplayNextEpisode()
112-
if int(m.top.position) >= (m.top.runTime - 30)
113-
showNextEpisodeButton()
114-
updateCount()
115-
return
116-
end if
110+
if m.top.content.contenttype = 4
117111

118-
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
119-
m.nextEpisodeButton.visible = false
120-
m.nextEpisodeButton.setFocus(false)
112+
if int(m.top.position) >= (m.top.runTime - 30)
113+
showNextEpisodeButton()
114+
updateCount()
115+
return
116+
end if
117+
118+
if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
119+
m.nextEpisodeButton.visible = false
120+
m.nextEpisodeButton.setFocus(false)
121+
end if
121122
end if
122123
end sub
123124

0 commit comments

Comments
 (0)