Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
daria
Visitor

Bookmark functionality in Scene Graph app

Hi!
I'm confused about this item in channel checklist:


Channels with video bookmarks functionality behave as expected and allow user to resume playback from location. Longer form content (15 minutes or over) are required to have bookmark functionality.


All I found about bookmarks in documentation is this page: https://sdkdocs.roku.com/display/sdkdoc ... ideo+Start. But it's about Brightscript components. I have Scene Graph app and Video component crashes when these metadata keys are specified.

I've implemented resuming video with Video's seek field. Progress is saved to local associative array, so it works fine, but saved positions are cleared on channel restart. Reviewers are saying that progress should be saved after channel restart as well. I guess I should use Registry for this, and I also guess it's total pain. May be there's a simpler way? How do you guys do this functionality?
Thanks!
0 Kudos
1 REPLY 1
belltown
Roku Guru

Re: Bookmark functionality in Scene Graph app

I don't think the link you included has much to do with bookmarking (saving/restoring the position for the currently-playing video). That link is referring to pre-buffering, whch I don't believe is the same thing.

I haven't implemented bookmarking in Scene Graph yet, but I'd assume you'd store the Video node 'position' field at regular intervals, and when re-starting the video the next time, set the 'seek' field. Set the 'notificationInterval' field to specify how often the position field is updated, and use a field observer on the 'position' field to trigger whatever it is you use to save the position value.

You could either save the bookmark position to the registry, or to your server. The advantage of saving to the server is that it allows your users' bookmarks to be synced across devices. I suspect most people just save them to the registry though. Bear in mind that registry capacity is limited, so you'll want to limit the number of bookmarks you store, getting rid of older ones as newer ones are added. Whichever approach you use, you can use a Task node to do the actual writing of the bookmark data (to the registry or to the server).

I do have some pre-Scene Graph code for handling bookmarks here. It shouldn't be too difficult to adapt to run in a Scene Graph Task: https://github.com/belltown/Roku-NewVideoPlayer/blob/master/source/Utils.brs. There's also code in there to handle legacy devices that don't support FormatJson; you can rid of that part of the code now.
0 Kudos