Forum Discussion
Is there a reason why you're using SetContentList and not just SetContent?
For a video node, do you have an observer on the "state" of the video node? It should fire on any error.
SetContentList is the function mentioned in the documentation, although I have tried SetContent. In terms of observing the state of the Video player, I can observe that it is buffering, playing, paused, etc. my problem is that I can't detect if its getting a 404 when trying to buffer a non-existent video.
Thank you for help btw
- renojim2 years agoCommunity Streaming Expert
I don't know why your "state" observer isn't working. I tried setting the URL to a nonexistent video on my server and my server returned a 404, my "state" observer fired, GetData() returned "error". and my video node "errorCode" was set to 404.
Edit: "errorCode" is set to -1. "errorStr" shows the 404.
- Helaman2 years agoChannel Surfer
Is that for a `roVideoPlayer` object or a `roSGNode` that represents a Video SceneGraph element? I have a "state" observer on the `roSGNode` for my video element, but it doesn't fire with errors, it just fires for states like "buffering", "paused", "playing", etc.
- renojim2 years agoCommunity Streaming Expert
That's for a Video node. My "onState" observer function fires first with "buffering" and then with "error" when I set the URL to a nonexistent file. I've also used observers with message ports and waited on the port in the main thread. That looks something like this:
Function displayVideo(video as Object) as Integer print "Displaying video: "; video["url"] vn = m.video_node vc = createObject("roSGNode", "ContentNode") vc.url = video.url vc.StreamFormat = video.StreamFormat print vn.observeField("position", m.port) print vn.observeField("control", m.port) print vn.observeField("state", m.port) vn.content = vc vn.setFocus(true) vn.control = "play" while true msg = wait(0,m.port) msgtype = type(msg) print msgtype if msgtype = "roSGNodeEvent" then node = msg.GetNode() field = msg.GetField() data = msg.GetData() print node, field, data if field = "position" then position = data else if field = "control" and data = "stop" then exit while else if field = "state" then if data = "finished" then exit while else if data = "buffering" then m.video_screen.visible = true else if data = "error" then print vn.errorCode print vn.errorMsg print vn.errorStr print vn.errorInfo else if data = "playing" then ' else if data = "paused" then ' end if end if else if msgtype = "roSGScreenEvent" then print msgtype, msg.GetData(), msg.isScreenClosed() vn.control = "stop" exit while end if end while vn.control = "stop" print vn.unobserveField("position") print vn.unobserveField("control") print vn.unobserveField("state") return position End Function
and produces this output:roSGNodeEvent video control play roSGNodeEvent video state buffering roSGNodeEvent video state error errorCode: -1 errorMsg: There was an error in the HTTP response. This could mean that malformed HTTP headers or an HTTP error code was returned. errorStr: reader pick stream error:HTTP error:HTTP server returned error code:404:extra:etype:buffer errorInfo: <Component: roAssociativeArray> = { category: "http" clipid: 1 dbgmsg: "reader pick stream error:HTTP error:HTTP server returned error code:404:extra:etype:buffer" drmerrcode: 0 errcode: 2 ignored: false source: "buffer:reader" }