Web SDK (incl. UX)

Event System

6min
the nativewaves sdk uses events to communicate between the playback business logic and the playback ui the custom events are emitted as window events, so they can be accessed from the outside webtonative => events being dispatched by the playback system nativetoweb => events emitted into the playback system here a quick example on how to emit and listen for events // listening window\ addeventlistener('webtonative',(event) => { console log('nativewaves event', event detail) }) // emitting const customevent = new customevent('nativetoweb', { detail { type 'seek request', payload { value 10 // seek to 10s in the currently playing video } }, }) window\ dispatchevent(customevent) events here you can find an overview of all available events that can be sent using the event system, separated into three event categories player events experience events sync events player events this category bundles all events related to video and audio playback on a player level, e g play, pause, seek, type payload description init volume? number muted? boolean duration? number isplaying? boolean islive? boolean isusingsync? boolean currenttime? number videoentityid? string audioentityid? string initialize player data play start video playback pause pause video playback replay start video playback from the beginning player update currenttime? number duration? number isplaying? boolean isbuffering? boolean isseeking? boolean islive? boolean volume? number muted? boolean src? string fullscreen? boolean notify ui about player data changes player update request forces player to send it's current state time update currenttime number duration number notify web about the most recent currenttime and duration seek value number notify about seek seek success accurate? boolean counter? number duration? number delay? number islive? boolean issyncactive? boolean currenttime number notify about successful seek seek failed error any notify about seek failure jump value number notify about jump jump success accurate? boolean counter? number duration? number delay? number islive? boolean currenttime number notify about successful jump jump failed error any notify about jump failure unmute notify about unmute mute notify about mute volume set notify volume set ready notify about ready buffering start notify about buffering start buffering end notify about buffering end throw error error any notify about error fullscreen request request fullscreen fullscreen exit exit fullscreen experience events this category bundles events related to the manifest playback like setting the manifest id, changing entities, type payload description playback update currenttime? number duration? number isplaying? boolean islive? boolean ischangingentity? boolean hasvideocontent? boolean hasended? boolean volume? number muted? boolean notify ui about playback data changes program id set programid string set program program loaded called after program successfully loaded program loading failed error any called after failed program load entity video set entityid string preventityid? string set entity (preventityid is deprecated not used any more) entity video set success entityid string called after successfully entity change entity video set failed error any called after failed entity change entity audio set entityid string set audio entity entity audio set success entityid string called after successfully audio entity change entity audio set failed error any called after failed audio entity change live go called after livego sync go called after syncgo exit webview tells mobile to close webview sync events this category bundles all events that are related to the nativewaves second screen sync like enabling/disabling the sync, starting the sync, stoping the sync, type payload description sync enable used to enable the sync (setting the enabled flag to true) sync disable used to disable the sync (setting the enabled flag to false) sync request showintroagain? boolean this will start a sync task on native sync success currenttime number ts? number called after sync was successful currenttime returns the currentposition of the new synctimeline, in seconds sync failed error any called after sync has failed sync stop this will stop all sync tasks on native and clear all active synctimelines if a resync is stopped, native will stop all sync tasks but keep all active synctimelines as is sync dismiss error dismiss sync error