iOS SDK (Core)
API Reference
26 min
please find below an overview of the available apis for you to use also check out the guides & tutorials docid\ ippr2twqdxeowi48ti62 chapter for useful information about using the sdk experienceplaybackservice experienceplaybackservice is the fundamental component within the sdk, serving as the main hub for all interactions between your application and the sdk think of it as the command center or the control room—it manages how the app communicates with the sdk, making sure they understand each other and work together seamlessly here's an overview of the interface exp manifest retrieving the information of the current exp manifest experienceplaybackservice expmanifest > nwexpmanifest? playback the sdk provides certain methods to control a playback initialize playback initializing the playback will set the playback view and sets a playbackdelegate experienceplaybackservice initializeplayback(playbackview uiview, delegate nwplaybackdelegate?) playback delegate setting a playbackdelegate will trigger the respective callback methods protocol nwexperienceplaybackservicedelegate { // called when playback has started func onplaybackstarted(contenttype nwcontenttype, isplaying bool) // called when playback seek has completed func onplaybackseekcompleted(position double) // called when playback has paused func onplaybackpaused() // called when playback has stopped func onplaybackstopped() // called during playback to report playback progress func onplaybackprogress(position double, duration double, hasended bool, hasvideocontent bool, islive bool, issync bool?) // called when an error occured func onerror( error nwerror) // called on mute toggle func onmute( mute bool) // called on systevolume change func onvolumechange( volume double) } playback controls start playback if the current program is a live event, the playback will automatically start at the live edge if it is a vod playback, the playback will start from the beginning // start playback at the most relevant position experienceplaybackservice startplayback() // start a synced playback will trigger an initial sync experienceplaybackservice startsyncedplayback() pause playback experienceplaybackservice pauseplayback() resume playback experienceplaybackservice resumeplayback() stop playback experienceplaybackservice stopplayback() mute/unmute audio let shouldmute bool = \<true|false> experienceplaybackservice muteaudio(shouldmute) seek to a position let endposition double = \<position> experienceplaybackservice seek(to endposition) jump backward/forward let jumpvalue double = \<value> experienceplaybackservice jump(by jumpvalue) content get available entities // get available video entities experienceplaybackservice getvideoentities() > \[nwentity]? // get available audio entities experienceplaybackservice getaudioentities() > \[nwentity]? get selected entity // get current selected video entityid experienceplaybackservice getselectedvideoentityid() > string? // get current selected audio entityid experienceplaybackservice getselectedaudioentityid() > string? set entity // set video entity experienceplaybackservice setselectedvideoentity(entityid string?) // set audio entity experienceplaybackservice setselectedaudioentity(entityid string?) second screen sync if the second screen sync is set up and configured for your company, it is easy to enable it in the sdk enable sync the second screen sync can be enabled using the syncconfig the syncconfig offers three options sync only a sync against a main screen is required for playback sync optional the sync is optional and if sync information is available, the user can choose to sync to a main screen sync no the sync is disabled to set the syncconfig just do the following let syncconfig = < sync only| sync optional| no sync> nwcore syncservice( , syncconfig syncconfig, ) audiosyncmode there are two modes the second screen sync can be used channelsync to sync against a live channel, e g a tv channel directsync to sync against a vod event channelsync the audiosyncmode is set to audiosyncmode channel by default to set the audiosyncmode just call nwcore syncservice( , audiosyncmode channel, ) all settings for the channelsync are configured via the appconfig in the console there the endpoint as well as the channel information required for syncing is set in case you want to overwrite the backend setting, you can manually set a channelid let channelid string = "\<channel id>" nwcore syncservice( , channelid channelid, ) directsync to enable the direct sync to e g sync against a vod event, you need to set the audiosyncmode to audiosyncmode library nwcore syncservice( , audiosyncmode library, ) additionally, you need to set a directsyncid , so the correct sync query is used let directsyncid string = "\<directsyncid>" nwcore syncservice( , directsyncid directsyncid, ) the directsyncid is created when sync information is extracted for vod events a common setup is to send the directsyncid as part of event information like the programid custom smds endpoint setting a custom smds endpoint will direct the audio parts to be checked for a sync to the given service let smdsendpoint = url(string "\<url>") nwcore syncservice( , smdsendpoint smdsendpoint, ) initialize sync initializing the sync will set up all necessary dependencies for operational mode and sets a syncdelegate experienceplaybackservice initializesync(syncdelegate nwsyncdelegate) sync delegate setting a syncdelegate will trigger the respective callback methods protocol nwaudiosyncservicedelegate { // called when sync was started func synchronizationoffsetfound(correlation mediaaudioquerymatch, syncstarttime double, isresync bool) // called when an error occured during sync func synchronizationerror( error nwerror) } sync controls to programmatically start, stop or cancel a sync, the interface provides the following methods // start a sync experienceplaybackservice startsync() // cancel a running sync experienceplaybackservice cancelsync() // stop a synchronized experience experienceplaybackservice stopsync() check current sync state to check the current playback sync state // check if plaback is currently running in a synced state experienceplaybackservice issynced() > bool // check if a running sync is currently in progress experienceplaybackservice issyncing() > bool // check if current sync state is after a resync has been done experienceplaybackservice isresync() > bool dismiss experience stopping the whole experience resets everything if a new exp program needs to be started, the old experience should be stopped before in order to avoid any misfunction if the close button within a playbackviewcontroller was tapped, this method is being called automatically and does not need to be triggered separately experienceplaybackservice stop() nwexpui nwexpui serves as a customizable interface to gui overlays the communication with the web layer is done using methods to send and receive certain events and states the class described in the section below wraps this functionality if you want to know more about the underlying system and the event system that is used to communicate between the native and web layer, you can find a more thorough explanation in the event system docid\ d58owrhhf 5ibm6a4pc9f chapter of the web sdk initialize exp see getting started docid 8iaga1mizev4mnuknnrjp on how to setup and start a full experience