Show Error Message If Stream Is Not Available?

How can I check if an HLS (M3U8) stream is available and if not show an error dialog?

Here’s the code I’m using to play the video:

sub onButtonSelected()
  'Ok'
  if m.ButtonGroup.buttonSelected = 0
    m.Video.visible = "true"
    m.Video.control = "play"
    m.Video.setFocus(true)
  'Exit button pressed'
  else
    m.Exiter.control = "RUN"
  end if
end sub

Hi jmatt0806,

The way we do it is by observing the video player state variable.

m.Video.observeField("state", "videoPlayerStateChanged")

Sub videoPlayerStateChanged()
    state = m.Video.state
    print "Video player state is now: " + state

    if(state = "error")
        print "ERROR - Code " + m.Video.errorCode.ToStr() + ", Message: " + m.Video.errorMsg
    end if
End Sub

And more info on dialogs can be found here: https://sdkdocs.roku.com/display/sdkdoc/Dialog
Hope this helps