Forum Discussion
Hi devnullpointer,
Are you using the Video node or Audio node for this? Also, can you provide me with a sample channel so our engineering team can further help you?
Thanks,
Jonathan
Hi RokuJonathanD ,
Sorry for the late reply. I'm using an Audio node. I've inserted the code from the XML and the BRS files respectively. The primeRadio function loads the contentNode from a TaskNode to the audio player. I then make sure the Scene gets the focus not the audio player, hoping this would solve the problem. Unfortunately as long as the audio player is playing and not "stop" then the keyevent never gets propagated up the chain. I've also added the onKeyEvent function to show I don't process the "*" key.
I'd prefer sending you full source files outside this thread to maintain source integrity, and we could update this thread with impending solution if any.
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2021 Xystra, Inc. All rights reserved. --> <component name="RadioGridView" extends="SGDEXComponent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd" > <interface> <function name="switchMode" /> </interface> <script type="text/brightscript" uri="RadioGridView.brs" /> <script type="text/brightscript" uri="pkg:/components/AppUtils.brs" /> <script type="text/brightscript" uri="pkg:/components/SGDEX/Views/utils/Utils.brs" /> <children> <!-- Background, randomly selected --> <Poster uri="pkg:/images/background/blue.png" width="1920.0" height="1080.0" translation="[0, 0]" /> <!-- Main Audio component --> <Audio id="streamPlayer" /> <!-- Headline --> <Group> <Poster uri="pkg:/images/logo.png" width="75" height="75" translation="[50.0, 60.0]" /> <Label id="radioHeadline" translation="[135, 30]" maxLines="1" /> <Label id="radioMoto" translation="[135, 150]" horizAlign="left" /> </Group> <!-- Now Playing component --> <Group id="nowStreaming" visible="true" > <Poster uri="pkg:/images/background/nowplaying.9.png" width="801" height="300" translation="[1120.0, 100.0]" /> <Poster id="nowPlayingLogo" width="200" height="200" translation="[1200, 150]" /> <Label id="nowPlayingStation" translation="[1430.0, 140.0]" horizAlign="left" /> <Label id="nowPlayingLocation" translation="[1430.0, 180.0]" horizAlign="left" /> <Label id="nowPlayingRDSHeader" translation="[1430.0, 230.0]" horizAlign="left" /> <Label id="nowPlayingRDS" translation="[1430.0, 255.0]" horizAlign="left" width="420" wrap="false" ellipsizeOnBoundary="true" /> <Poster id="nowPlayingControl" height="75" width="75" translation="[1480.0, 290.0]" /> <Poster id="nowPlayingFavorite" height="75" width="75" translation="[1570.0, 290.0]" /> </Group> <!-- RowList of channels --> <RowList id="stationList" translation="[ 100, 400 ]" itemComponentName="stationItem" numRows="4" itemSize="[ 1720, 250 ]" rowItemSize="[ [170, 170] ]" rowItemSpacing="[ [ 50, 0 ] ]" showRowLabel="[ true ]" drawFocusFeedback="true" focusBitmapUri="pkg:/images/background/stationfocus.9.png" rowFocusAnimationStyle="floatingFocus" /> <Timer id="rdsTimer" repeat="true" duration="5" /> <!-- Aux features controls --> <Group> <Poster uri="pkg:/images/star.png" width="40.0" height="40.0" translation="[1560,10]" /> <Label id="menuLabel" translation="[1610, 15]" wrap="false" /> </Group> <Group id="busySpinner" visible="false" > <Poster uri="pkg:/images/background/modal.png" width="1920" height="1080" translation="[0.0,0.0]" /> <BusySpinner id="spinner" translation="[960, 540]" /> <Label id="busyLoading" translation="[820, 650]" /> </Group> </children> </component>
sub primeRadio() print "Starting playback: " + m.playTask.stationContent.title m.current = m.playTask.stationContent m.tgRegistry.Write("lastRadio", m.current.id) m.tgRegistry.Flush() m.nowPlayingStation.text = m.playTask.stationContent.title m.nowPlayingLocation.text = m.playTask.stationContent.location m.nowPlayingLogo.uri = "<link to png file>" m.nowPlayingRDS.text = "Not available" if m.playTask.stationContent.rds then startRDSTimer() end if favsJson = m.tgRegistry.Read("radioFavorites") favorites = ParseJson(favsJson) m.currentIsFavorite = false for each fav in favorites if fav.id = m.current.id then m.currentIsFavorite = true end if end for if m.currentIsFavorite then m.nowPlayingFavorite.uri = "pkg:/images/heart-focus.png" else m.nowPlayingFavorite.uri = "pkg:/images/heart-off.png" end if m.nowPlayingControl.uri = "pkg:/images/pause.png" m.audioPlayer.content = m.playTask.stationContent m.audioPlayer.control = "play" m.top.getScene().setFocus(true) if not m.isSubGroup then ShowSpinner(false) end if end sub function onKeyEvent(_key_ as String, _press_ as Boolean) as Boolean handled = false if _press_ then ? _key_ + " pressed." if _key_ = "down" then if not m.stationList.hasFocus() then m.stationList.setFocus(true) handled = True end if end if if _key_ = "up" then m.nowPlayingControl.setFocus(true) end if if _key_ = "left" or _key_ = "right" then if not m.stationList.hasFocus() then if m.nowPlayingControl.hasFocus() then m.nowPlayingFavorite.setFocus(true) else m.nowPlayingControl.setFocus(true) end if handled = True end if end if if _key_ = "OK" then if m.nowPlayingControl.hasFocus() then OnNowPlayingControlSelected() handled = True else if m.nowPlayingFavorite.hasFocus() then OnNowPlayingFavoriteSelected() handled = True end if end if 'keys not used in fullscreen if _key_ = "replay" or _key_ = "play" or _key_ = "rewind" or _key_ = "fastforward" then handled = true end if end if return handled end function
- devnullpointer4 years agoStreaming Star
RokuJonathanD any updates from the dev team?
- JesUltra4 years agoStreaming Star
I have a similar issue with the Video node. My channel has a main menu, on which the user can browse, and pressing the *-button brings up some additional information about the selected item. When the user selects an item to play, the Video node becomes visible and in focus, and then the user will get the built-in options menu for selection subtitles, etc. which is desired. However, when returning to the main menu, the *-button still brings up the built-in menu, rather than going to onKeyEvent as it did the first time om the main menu.
I have tried using removeChild() to remove the (hidden) video component, when returning to the main menu, just to see if that made a difference, but it did not.
I wonder if the original poster also sees the issue remain after their Audio node is done playing.
- JesUltra4 years agoStreaming Star
I guess that for my last question, I should have read the original post properly, as it clearly states that after Audio control is set to "stop", the onKeyEvent() handling of the *-key is restored.
I have tried the same on my Video node, and similarly see that onKeyEvent() handling resumes once the video is properly stopped. (Apparently pausing, hiding, or even disconnecting the Video node from its parent was not sufficient.)
So it seems that Audio/Video on Roku has special handling of the *-key, in that while playing these components will handle it irrespective of the ordinary focus chain. That could be considered both good and bad. Good because all Roku users have access to the same audio/subtitle/accessibility UI across all channels, even as some large brands would have liked to put their own touch on the accessibility menus.
It would be nice to get official confirmation from Roku that this is how it is designed to be. That channels cannot have custom handling of the *-key while audio or video is playing.