Hi,
Just starting out in Brightscript, and my first project is to produce a video (multilanguage) with or without subtitles. However, my first script crashes after a few seconds and the unit reboots.
For the moment, I'm just trying to put the time code up on the screen with the video.
debug=false
REM Video resolution to use
VideoResolution$="1920x1080x50p"
REM Create the video player
v=CreateObject("roVideoPlayer")
REM And a container to receive messages
p=createobject("roMessagePort")
v.SetPort(p)
REM Volume of the video
v.SetVolume(100)
REM Subtitle field
subtitle=CreateObject("roTextField",0,750,1920,380,0)
REM Set the resolution
mode = CreateObject("roVideoMode")
mode.SetMode(VideoResolution$)
REM Play the first file
play:
ok=v.PlayFile("English.mp4")
REM Check it has played OK
if ok=0 then
ifdebugthenprint"Playback failed"
gotoplay
endif
loop:
REM Wait for any messages
msg=wait(0,p)
subtitle.Raise()
subtitle.SetCursorPos(0,0)
print #subtitle, v.GetPlaybackPosition()
ifdebugprinttype(msg)
REM Video event
iftype(msg) ="roVideoEvent"then
REM Event 8 is end of media play
ifmsg.GetInt() =8then
gotoplay
endif
endif
REM Waiting loop, forever
goto loop
If I remove the subtitle object, then it plays OK.