Your Digital Media Has Never Looked So Good

 
Blackhawk
Topic Author
Posts: 76
Joined: Wed Jan 07, 2015 4:42 am

Upload error

Mon Sep 17, 2018 8:27 pm

I had setup my details screen

' ********** Copyright 2016 Roku Corp. All Rights Reserved. ********** 

 ' inits details screen

 ' sets all observers

 ' configures buttons for Details screen

Function Init()

 ? "[DetailsScreen] init"

 m.top.observeField("visible", "onVisibleChange")

 m.top.observeField("focusedChild", "OnFocusedChildChange")

 m.buttons = m.top.findNode("Buttons")

 m.poster = m.top.findNode("Poster")

 m.description = m.top.findNode("Description")

 m.background = m.top.findNode("Background")

 

 ' create buttons

 result = []

 for each button in ["Play", "Second button"]

 result.push({title : button})

 end for

 m.buttons.content = ContentList2SimpleNode(result)

End Function

' set proper focus to buttons if Details opened and stops Video if Details closed

Sub onVisibleChange()

 ? "[DetailsScreen] onVisibleChange"

 if m.top.visible = true then

 m.buttons.jumpToItem = 0

 m.buttons.setFocus(true)

 else

 m.Player.visible = false

 m.Player.control = "stop"

 m.poster.uri=""

 m.background.uri=""

 end if

End Sub

' set proper focus to Buttons in case if return from Video PLayer

Sub OnFocusedChildChange()

 if m.top.isInFocusChain() and not m.buttons.hasFocus() and not m.Player.hasFocus() then

 m.buttons.setFocus(true)

 end if

End Sub

' set proper focus on buttons and stops video if return from Playback to details

Sub onVideoVisibleChange()

 if m.Player.visible = false and m.top.visible = true

 m.buttons.setFocus(true)

 m.Player.control = "stop"

 end if

End Sub

sub PlayerStateChanged()

 print "EntryScene: PlayerStateChanged(), state = "; m.Player.state

 if m.Player.state = "done" or m.Player.state = "stop"

 m.Player.visible = false

 m.list.setFocus(true) 'NB. the player took the focus away, so get it back

 end if

end sub

' on Button press handler

Sub onItemSelected()

' compile into a VideoContent node

 content = CreateObject("roSGNode", "VideoContent")

 content.setFields(videoContent)

 ' first button is Play

 if m.top.itemSelected = 0

 if m.Player = invalid:

 m.Player = m.top.CreateChild("Player")

 m.Player.observeField("state", "PlayerStateChanged")

 end if

 'start the player

 m.Player.content = content

 m.Player.visible = true

 m.Player.control = "play"

 end if

End Sub

' Content change handler

Sub OnContentChange()

 m.description.content = m.top.content

 m.description.Description.width = "770"

 m.Player.content = m.top.content

 m.top.streamUrl = m.top.content.url

 m.poster.uri = m.top.content.hdBackgroundImageUrl

 m.background.uri = m.top.content.hdBackgroundImageUrl

End Sub

'///////////////////////////////////////////'

' Helper function convert AA to Node

Function ContentList2SimpleNode(contentList as Object, nodeType = "ContentNode" as String) as Object

 result = createObject("roSGNode",nodeType)

 if result <> invalid

 for each itemAA in contentList

 item = createObject("roSGNode", nodeType)

 item.setFields(itemAA)

 result.appendChild(item)

 end for

 end if

 return result

End Function



and I got this error
Invalid value for left-side of expression. (runtime error &he4) in pkg:/components/screens/DetailsScreen/DetailsScreen.brs(32)~
Last edited by Blackhawk on Wed Sep 19, 2018 7:44 pm, edited 1 time in total.
 
User avatar
Komag
Posts: 748
Joined: Fri Aug 22, 2014 3:42 am

Re: Upload error

Mon Sep 17, 2018 11:05 pm

 m.poster.uri=""
 m.background.uri=""

These should be url (U R L)

You also have that below in OnContentChange()

(Notice the error message told you the line number)
 
Blackhawk
Topic Author
Posts: 76
Joined: Wed Jan 07, 2015 4:42 am

Re: Upload error

Wed Sep 19, 2018 7:49 pm

I got this error after fixing this last one


Invalid value for left-side of expression. (runtime error &he4) in pkg:/components/screens/DetailsScreen/DetailsScreen.brs(32)
032:         m.Player.visible = false
Backtrace:
#0  Function onvisiblechange() As Void
   file/line: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(33)
 
User avatar
Komag
Posts: 748
Joined: Fri Aug 22, 2014 3:42 am

Re: Upload error

Thu Sep 20, 2018 7:52 am

I looks like you'll have to make sure there is definitely an m.Player at that point. You can test it by printing to console above it, put it a line
? "m.Player = " m.Player
and see what it says, such as "invalid" or a component or something
 
Blackhawk
Topic Author
Posts: 76
Joined: Wed Jan 07, 2015 4:42 am

Re: Upload error

Fri Oct 05, 2018 11:09 pm

I changed the code to this

' ********** Copyright 2016 Roku Corp. All Rights Reserved. **********

 ' inits details screen

 ' sets all observers

 ' configures buttons for Details screen

Function Init()

 print "DetailsScreen.brs - [init]"

 m.top.observeField("visible", "onVisibleChange")

 m.top.observeField("focusedChild", "OnFocusedChildChange")

 m.buttons = m.top.findNode("Buttons")

 m.poster = m.top.findNode("Poster")

 m.description = m.top.findNode("Description")

 m.background = m.top.findNode("Background")

 m.fadeIn = m.top.findNode("fadeinAnimation")

 m.fadeOut = m.top.findNode("fadeoutAnimation")

 ' create buttons

 result = []

 for each button in ["Play", "Second button"]

 result.push({title : button})

 end for

 m.buttons.content = ContentList2SimpleNode(result)

End Function

' set proper focus to buttons if Details opened and stops Video if Details closed

Sub onVisibleChange()

 print "DetailsScreen.brs - [onVisibleChange]"

 if m.top.visible

 m.fadeIn.control="start"

 m.buttons.jumpToItem = 0

 m.buttons.setFocus(true)

 else

 m.fadeOut.control="start"

 m.Player.visible = false

 m.Player.control = "stop"

 m.poster.url=""

 m.background.url=""

 end if

End Sub

sub PlayerStateChanged()

 print "EntryScene: PlayerStateChanged(), state = "; m.Player.state

 if m.Player.state = "done" or m.Player.state = "stop"

 m.Player.visible = false

 m.list.setFocus(true) 'NB. the player took the focus away, so get it back

 end if

end sub

' set proper focus to Buttons in case if return from Video PLayer

Sub OnFocusedChildChange()

 print "DetailsScreen.brs - [OnFocusedChildChange]"

 if m.top.isInFocusChain() and not m.buttons.hasFocus() and not m.videoPlayer.hasFocus() then

 m.buttons.setFocus(true)

 end if

End Sub

' on Button press handler

Sub onItemSelected()

 print "DetailsScreen.brs - [onItemSelected]"

 content = CreateObject("roSGNode", "VideoContent")

 content.setFields(videoContent)

 if m.Player = invalid:

 m.Player = m.top.CreateChild("Player")

 m.Player.observeField("state", "PlayerStateChanged")

 end if

 ' first button is Play

 if m.top.itemSelected = 0

 'start the player

 m.Player.content = content

 m.Player.visible = true

 m.Player.control = "play"

 end if

End Sub

' Content change handler

Sub OnContentChange()

 print "DetailsScreen.brs - [OnContentChange]"

 m.description.content = m.top.content

 m.description.Description.width = "1120"

 m.Player.content = m.top.content

 m.top.streamUrl = m.top.content.url

 m.poster.url = m.top.content.hdBackgroundImageUrl

 m.background.url = m.top.content.hdBackgroundImageUrl

End Sub

'///////////////////////////////////////////'

' Helper function convert AA to Node

Function ContentList2SimpleNode(contentList as Object, nodeType = "ContentNode" as String) as Object

 print "DetailsScreen.brs - [ContentList2SimpleNode]"

 result = createObject("roSGNode", nodeType)

 if result <> invalid

 for each itemAA in contentList

 item = createObject("roSGNode", nodeType)

 item.setFields(itemAA)

 result.appendChild(item)

 end for

 end if

 return result

End Function


Yet I keep getting this error:
Invalid value for left-side of expression. (runtime error &he4) in pkg:/components/DetailsScreen/DetailsScreen.brs(35)
035:     m.Player.visible = false
Backtrace:
#0  Function onvisiblechange() As Void
   file/line: pkg:/components/DetailsScreen/DetailsScreen.brs(36)
 
destruk
Posts: 2599
Joined: Sat Dec 18, 2010 4:58 pm

Re: Upload error

Sun Oct 07, 2018 6:08 pm

I probably wouldn't even stick that line in the OnVisibleChange routine.  You are setting it visible in the OnItemSelected, and you are setting visibility to false when the video state is stopped or done.  You might want to add some error conditions for streams that fail to play to tidy up the possible exits from the playback routine.  If you want it to be visible=false on init then you can set that in the init function or in the xml.
 
Blackhawk
Topic Author
Posts: 76
Joined: Wed Jan 07, 2015 4:42 am

Re: Upload error

Thu Oct 11, 2018 8:48 pm

I removed the visible method

' ********** Copyright 2016 Roku Corp. All Rights Reserved. **********

 ' inits details screen

 ' sets all observers

 ' configures buttons for Details screen

Function Init()

 print "DetailsScreen.brs - [init]"

 m.top.observeField("focusedChild", "OnFocusedChildChange")

 m.buttons = m.top.findNode("Buttons")

 m.poster = m.top.findNode("Poster")

 m.description = m.top.findNode("Description")

 m.background = m.top.findNode("Background")

 m.fadeIn = m.top.findNode("fadeinAnimation")

 m.fadeOut = m.top.findNode("fadeoutAnimation")

 ' create buttons

 result = []

 for each button in ["Play", "Second button"]

 result.push({title : button})

 end for

 m.buttons.content = ContentList2SimpleNode(result)

End Function

sub PlayerStateChanged()

 print "EntryScene: PlayerStateChanged(), state = "; m.Player.state

 if m.Player.state = "done" or m.Player.state = "stop"

 m.Player.visible = false

 m.list.setFocus(true) 'NB. the player took the focus away, so get it back

 end if

end sub

' set proper focus to Buttons in case if return from Video PLayer

Sub OnFocusedChildChange()

 print "DetailsScreen.brs - [OnFocusedChildChange]"

 if m.top.isInFocusChain() and not m.buttons.hasFocus() and not m.videoPlayer.hasFocus() then

 m.buttons.setFocus(true)

 end if

End Sub

' on Button press handler

Sub onItemSelected()

 print "DetailsScreen.brs - [onItemSelected]"

 content = CreateObject("roSGNode", "VideoContent")

 content.setFields(videoContent)

 if m.Player = invalid:

 m.Player = m.top.CreateChild("Player")

 m.Player.observeField("state", "PlayerStateChanged")

 end if

 ' first button is Play

 if m.top.itemSelected = 0

 'start the player

 m.Player.content = content

 m.Player.visible = true

 m.Player.control = "play"

 end if

End Sub

' Content change handler

Sub OnContentChange()

 print "DetailsScreen.brs - [OnContentChange]"

 m.description.content = m.top.content

 m.description.Description.width = "1120"

 m.Player.content = m.top.content

 m.top.streamUrl = m.top.content.url

 m.poster.url = m.top.content.hdBackgroundImageUrl

 m.background.url = m.top.content.hdBackgroundImageUrl

End Sub

'///////////////////////////////////////////'

' Helper function convert AA to Node

Function ContentList2SimpleNode(contentList as Object, nodeType = "ContentNode" as String) as Object

 print "DetailsScreen.brs - [ContentList2SimpleNode]"

 result = createObject("roSGNode", nodeType)

 if result <> invalid

 for each itemAA in contentList

 item = createObject("roSGNode", nodeType)

 item.setFields(itemAA)

 result.appendChild(item)

 end for

 end if

 return result

End Function



Now I got this error:

Invalid value for left-side of expression. (runtime error &he4) in pkg:/components/DetailsScreen/DetailsScreen.brs(65)
065:   m.Player.content                             = m.top.content
Backtrace:
#0  Function oncontentchange() As Void
   file/line: pkg:/components/DetailsScreen/DetailsScreen.brs(66)
Local Variables:
global           Interface:ifGlobal
m                roAssociativeArray refcnt=2 count:8
Threads:
ID    Location                                Source Code
 0    pkg:/source/main.brs(44)                msg = wait(0, m.port)
 1*   ...tailsScreen/DetailsScreen.brs(65)    m.Player.content                             = m.top.content
 2    ...onents/Content/UriHandler.brs(87)    msg = wait(0, m.port)
  *selected
 
joetesta
Posts: 771
Joined: Wed Apr 20, 2011 11:48 am

Re: Upload error

Fri Oct 12, 2018 11:36 am

the error indicates that m.player doesn't exist yet.  Move this to your init() routine:

 m.Player = m.top.CreateChild("Player")
aspiring
 
Blackhawk
Topic Author
Posts: 76
Joined: Wed Jan 07, 2015 4:42 am

Re: Upload error

Sun Oct 14, 2018 5:26 pm

I just added the header
' on Button press handler

Sub onItemSelected()

 print "DetailsScreen.brs - [onItemSelected]"

 content = CreateObject("roSGNode", "VideoContent")

 content.setFields(videoContent)

 

 if m.Player = invalid:

 m.Player = m.top.CreateChild("Player")

 m.Player.observeField("state", "PlayerStateChanged")

 else

 m.Player = m.top.CreateChild("Player")

 end if

 ' first button is Play

 if m.top.itemSelected = 0

 'start the player

 m.Player.content = content

 m.Player.visible = true

 m.Player.control = "play"

 end if

End Sub



I still get this error
Invalid value for left-side of expression. (runtime error &he4) in pkg:/components/DetailsScreen/DetailsScreen.brs(65)

065:   m.Player.content
 
joetesta
Posts: 771
Joined: Wed Apr 20, 2011 11:48 am

Re: Upload error

Mon Oct 15, 2018 11:02 pm

oops! "player" is not a standard component; should be "video"
 m.Player = m.top.CreateChild("Video")

https://sdkdocs.roku.com/display/sdkdoc/Video
aspiring

Who is online

Users browsing this forum: No registered users and 3 guests