diff --git a/components/JFVideo.brs b/components/JFVideo.brs
index b2b1c40c6..6d65b7c11 100644
--- a/components/JFVideo.brs
+++ b/components/JFVideo.brs
@@ -38,21 +38,24 @@ sub init()
m.captionTask.observeField("useThis", "checkCaptionMode")
m.top.observeField("currentSubtitleTrack", "loadCaption")
m.top.observeField("globalCaptionMode", "toggleCaption")
-
- m.top.suppressCaptions = True
- toggleCaption()
-
+ if get_user_setting("playback.subs.custom") = "false"
+ m.top.suppressCaptions = false
+ else
+ m.top.suppressCaptions = true
+ toggleCaption()
+ end if
end sub
sub loadCaption()
- m.top.suppressCaptions = m.captionTask.useThis
- m.captionTask.url = m.top.currentSubtitleTrack
+ if m.top.suppressCaptions
+ m.captionTask.url = m.top.currentSubtitleTrack
+ end if
end sub
sub toggleCaption()
m.captionTask.playerState = m.top.state + m.top.globalCaptionMode
- if m.top.globalCaptionMode = "On"
- m.captionTask.playerState = m.captionTask.playerState + "Wait"
+ if LCase(m.top.globalCaptionMode) = "on"
+ m.captionTask.playerState = m.top.state + m.top.globalCaptionMode + "w"
m.captionGroup.visible = true
else
m.captionGroup.visible = false
@@ -60,8 +63,7 @@ sub toggleCaption()
end sub
sub updateCaption ()
- while m.captionGroup.removeChildIndex(0)
- end while
+ m.captionGroup.removeChildrenIndex(m.captionGroup.getChildCount(), 0)
m.captionGroup.appendChildren(m.captionTask.currentCaption)
end sub
@@ -71,10 +73,6 @@ sub onContentChange()
m.top.observeField("position", "onPositionChanged")
- ' If video content type is not episode, remove position observer
- ' if m.top.content.contenttype <> 4
- ' m.top.unobserveField("position")
- ' end if
end sub
sub onNextEpisodeDataLoaded()
@@ -86,12 +84,11 @@ end sub
'
' Runs Next Episode button animation and sets focus to button
sub showNextEpisodeButton()
- if m.top.content.contenttype = 4
- if not m.nextEpisodeButton.visible
- m.showNextEpisodeButtonAnimation.control = "start"
- m.nextEpisodeButton.setFocus(true)
- m.nextEpisodeButton.visible = true
- end if
+ if m.top.content.contenttype <> 4 then return
+ if not m.nextEpisodeButton.visible
+ m.showNextEpisodeButtonAnimation.control = "start"
+ m.nextEpisodeButton.setFocus(true)
+ m.nextEpisodeButton.visible = true
end if
end sub
@@ -111,24 +108,24 @@ end sub
' Checks if we need to display the Next Episode button
sub checkTimeToDisplayNextEpisode()
- if m.top.content.contenttype = 4
+ if m.top.content.contenttype <> 4 then return
- if int(m.top.position) >= (m.top.runTime - 30)
- showNextEpisodeButton()
- updateCount()
- return
- end if
+ if int(m.top.position) >= (m.top.runTime - 30)
+ showNextEpisodeButton()
+ updateCount()
+ return
+ end if
- if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
- m.nextEpisodeButton.visible = false
- m.nextEpisodeButton.setFocus(false)
- end if
+ if m.nextEpisodeButton.visible or m.nextEpisodeButton.hasFocus()
+ m.nextEpisodeButton.visible = false
+ m.nextEpisodeButton.setFocus(false)
end if
end sub
' When Video Player state changes
sub onPositionChanged()
m.captionTask.currentPos = Int(m.top.position * 1000)
+ ' Check if dialog is open
m.dialog = m.top.getScene().findNode("dialogBackground")
if not isValid(m.dialog)
checkTimeToDisplayNextEpisode()
diff --git a/components/captionTask.brs b/components/captionTask.brs
index f285857d5..5a58b20a8 100644
--- a/components/captionTask.brs
+++ b/components/captionTask.brs
@@ -32,28 +32,27 @@ sub setFont()
if fontlist.count() > 0
m.font.uri = "tmp:/" + fontlist[0]
m.font.size = m.fontSize
- m.top.useThis = True
+ else
+ reg = CreateObject("roFontRegistry")
+ m.font = reg.GetDefaultFont(m.fontSize, false, false)
end if
end sub
sub fetchCaption()
- if m.top.useThis
+ m.captionTimer.control = "stop"
+ re = CreateObject("roRegex", "(http.*?\.vtt)", "s")
+ url = re.match(m.top.url)[0]
+ if url <> invalid
+ m.reader.setUrl(url)
+ text = m.reader.GetToString()
+ m.captionList = parseVTT(text)
+ m.captionTimer.control = "start"
+ else
m.captionTimer.control = "stop"
- re = CreateObject("roRegex", "(http.*?\.vtt)", "s")
- url = re.match(m.top.url)[0]
- ?url
- if url <> invalid
- m.reader.setUrl(url)
- text = m.reader.GetToString()
- m.captionList = parseVTT(text)
- m.captionTimer.control = "start"
- else
- m.captionTimer.control = "stop"
- end if
end if
end sub
-function newlabel(txt):
+function newlabel(txt)
label = CreateObject("roSGNode", "Label")
label.text = txt
label.font = m.font
@@ -82,8 +81,9 @@ function newRect(lg)
rect.width = 0
rect.height = 0
end if
+ rectLG.translation = [0, -rect.height / 2]
rectLG.horizalignment = "center"
- rectLG.vertalignment = "bottom"
+ rectLG.vertalignment = "center"
rectLG.appendchild(rect)
return rectLG
end function
@@ -91,7 +91,7 @@ end function
sub updateCaption ()
m.top.currentCaption = []
- if m.top.playerState = "playingOn"
+ if LCase(m.top.playerState) = "playingon"
m.top.currentPos = m.top.currentPos + 100
texts = []
for each entry in m.captionList
@@ -107,10 +107,8 @@ sub updateCaption ()
lines = newLayoutGroup(labels)
rect = newRect(lines)
m.top.currentCaption = [rect, lines]
- else if right(m.top.playerState, 4) = "Wait"
- m.top.playerState = "playingOn"
- else
- m.top.currentCaption = []
+ else if LCase(m.top.playerState.right(1)) = "w"
+ m.top.playerState = m.top.playerState.left(len (m.top.playerState) - 1)
end if
end sub
diff --git a/components/captionTask.xml b/components/captionTask.xml
index 20bef482f..167b9936d 100644
--- a/components/captionTask.xml
+++ b/components/captionTask.xml
@@ -5,7 +5,6 @@
-
diff --git a/settings/settings.json b/settings/settings.json
index 8dabaf52e..11bcd9cb8 100644
--- a/settings/settings.json
+++ b/settings/settings.json
@@ -63,6 +63,13 @@
"settingName": "playback.subs.onlytext",
"type": "bool",
"default": "false"
+ },
+ {
+ "title": "Use Custom Subtitles",
+ "description": "Use custom subtitles instead of Roku default subtitles",
+ "settingName": "playback.subs.custom",
+ "type": "bool",
+ "default": "false"
}
]
},
@@ -129,11 +136,11 @@
"default": "false"
},
{
- "title":"Disable Community Rating for Episodes",
+ "title": "Disable Community Rating for Episodes",
"description": "If enabled, the star and community rating for episodes of a TV show will be removed. This is to prevent spoilers of an upcoming good/bad episode.",
"settingName": "ui.tvshows.disableCommunityRating",
- "type":"bool",
- "default":"false"
+ "type": "bool",
+ "default": "false"
}
]
},
diff --git a/source/Main.brs b/source/Main.brs
index 0d84e6209..565186e04 100644
--- a/source/Main.brs
+++ b/source/Main.brs
@@ -42,12 +42,14 @@ sub Main (args as dynamic) as void
m.scene.observeField("exit", m.port)
' Downloads and stores a fallback font to tmp:/
- re = CreateObject("roRegex", "Name.:.(.*?).,.Size", "s")
- filename = APIRequest("FallbackFont/Fonts").GetToString()
- filename = re.match(filename)
- if filename.count() > 0
- filename = filename[1]
- APIRequest("FallbackFont/Fonts/" + filename).gettofile("tmp:/font")
+ if parseJSON(APIRequest("/System/Configuration/encoding").GetToString())["EnableFallbackFont"] = true
+ re = CreateObject("roRegex", "Name.:.(.*?).,.Size", "s")
+ filename = APIRequest("FallbackFont/Fonts").GetToString()
+ filename = re.match(filename)
+ if filename.count() > 0
+ filename = filename[1]
+ APIRequest("FallbackFont/Fonts/" + filename).gettofile("tmp:/font")
+ end if
end if
' Only show the Whats New popup the first time a user runs a new client version.
diff --git a/source/utils/Subtitles.brs b/source/utils/Subtitles.brs
index 3462caffa..30c755e30 100644
--- a/source/utils/Subtitles.brs
+++ b/source/utils/Subtitles.brs
@@ -86,8 +86,6 @@ function setupSubtitle(video, subtitles, subtitle_idx = -1) as integer
if selectedSubtitle.IsEncoded
' With encoded subtitles, turn off captions
- ?"Check2"
-
video.globalCaptionMode = "Off"
else
' If this is a text-based subtitle, set relevant settings for roku captions
@@ -178,7 +176,6 @@ sub turnoffSubtitles()
video = m.scene.focusedChild.focusedChild
current = video.SelectedSubtitle
video.SelectedSubtitle = -1
- ?"Check3"
video.globalCaptionMode = "Off"
m.device.EnableAppFocusEvent(false)
' Check if Enoded subtitles are being displayed, and turn off