package com.connatixplayersdkreactnative import com.cnx.connatixplayersdk.external.* import com.cnx.connatixplayersdk.external.EventType.Companion.fromString import com.facebook.react.bridge.* import com.facebook.react.common.MapBuilder import com.facebook.react.uimanager.SimpleViewManager import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.UIManagerHelper import com.facebook.react.uimanager.common.UIManagerType import com.facebook.react.uimanager.events.RCTEventEmitter import kotlinx.serialization.json.Json import org.json.JSONObject class PlayspacePlayerViewManager(private var context: ReactApplicationContext) : SimpleViewManager() { override fun getName() = "RCTPlayspacePlayer" override fun createViewInstance(reactContext: ThemedReactContext): PlayspacePlayer { val playspacePlayer = PlayspacePlayer(reactContext, null) playspacePlayer.onPlayerEvent = { onPlayerEvent(it, playspacePlayer.id) } return playspacePlayer } override fun getCommandsMap(): MutableMap { val hashMap: MutableMap = HashMap() hashMap[SET_PLAYSPACE_CONFIG_METHOD] = SET_PLAYSPACE_CONFIG_COMMAND hashMap[STOP_PLAYER_METHOD] = STOP_PLAYER_COMMAND hashMap[PLAY_METHOD] = PLAY_COMMAND hashMap[PAUSE_METHOD] = PAUSE_COMMAND hashMap[SET_VOLUME_METHOD] = SET_VOLUME_COMMAND hashMap[SET_QUALITY_METHOD] = SET_QUALITY_COMMAND hashMap[GET_QUALITY_METHOD] = GET_QUALITY_COMMAND hashMap[DISABLE_ADVERTISING_METHOD] = DISABLE_ADVERTISING_COMMAND hashMap[ENABLE_ADVERTISING_METHOD] = ENABLE_ADVERTISING_COMMAND hashMap[SET_MACROS_METHOD] = SET_MACROS_COMMAND hashMap[SET_PRE_ROLL_BREAK_METHOD] = SET_PRE_ROLL_BREAK_COMMAND hashMap[SET_POST_ROLL_BREAK_METHOD] = SET_POST_ROLL_BREAK_COMMAND hashMap[ADD_FRIENDLY_OBSTRUCTION_METHOD] = ADD_FRIENDLY_OBSTRUCTION_COMMAND hashMap[REMOVE_FRIENDLY_OBSTRUCTION_METHOD] = REMOVE_FRIENDLY_OBSTRUCTION_COMMAND hashMap[GET_STORY_POSITION_METHOD] = GET_STORY_POSITION_COMMAND hashMap[SET_STORY_POSITION_METHOD] = SET_STORY_POSITION_COMMAND hashMap[GET_STORY_ID_METHOD] = GET_STORY_ID_COMMAND hashMap[GET_STORY_TIMELINE_METHOD] = GET_STORY_TIMELINE_COMMAND hashMap[GET_LAYOUT_METHOD] = GET_LAYOUT_COMMAND hashMap[SET_LAYOUT_METHOD] = SET_LAYOUT_COMMAND hashMap[SET_CTA_LABEL_METHOD] = SET_CTA_LABEL_COMMAND hashMap[GET_STORY_METADATA_METHOD] = GET_STORY_METADATA_COMMAND hashMap[LISTEN_FOR_METHOD] = LISTEN_FOR_COMMAND hashMap[LISTEN_FOR_MORE_METHOD] = LISTEN_FOR_MORE_COMMAND hashMap[LISTEN_FOR_ALL_EVENTS_METHOD] = LISTEN_FOR_ALL_EVENTS_COMMAND hashMap[REMOVE_METHOD] = REMOVE_COMMAND hashMap[REMOVE_ALL_EVENTS_METHOD] = REMOVE_ALL_EVENTS_COMMAND return hashMap } override fun getExportedCustomBubblingEventTypeConstants(): MutableMap { val hashMap: MutableMap = java.util.HashMap() hashMap[SET_PLAYSPACE_CONFIG_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_PLAYSPACE_CONFIG_CALLBACK)) hashMap[PLAY_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, PLAY_CALLBACK)) hashMap[PAUSE_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, PAUSE_CALLBACK)) hashMap[SET_VOLUME_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_VOLUME_CALLBACK)) hashMap[SET_QUALITY_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_QUALITY_CALLBACK)) hashMap[GET_QUALITY_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, GET_QUALITY_CALLBACK)) hashMap[DISABLE_ADVERTISING_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, DISABLE_ADVERTISING_CALLBACK)) hashMap[ENABLE_ADVERTISING_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, ENABLE_ADVERTISING_CALLBACK)) hashMap[SET_MACROS_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_MACROS_CALLBACK)) hashMap[SET_PRE_ROLL_BREAK_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_PRE_ROLL_BREAK_CALLBACK)) hashMap[SET_POST_ROLL_BREAK_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_POST_ROLL_BREAK_CALLBACK)) hashMap[SET_POST_ROLL_BREAK_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_POST_ROLL_BREAK_CALLBACK)) hashMap[ADD_FRIENDLY_OBSTRUCTION_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, ADD_FRIENDLY_OBSTRUCTION_CALLBACK)) hashMap[REMOVE_FRIENDLY_OBSTRUCTION_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, REMOVE_FRIENDLY_OBSTRUCTION_CALLBACK)) hashMap[GET_STORY_POSITION_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, GET_STORY_POSITION_CALLBACK)) hashMap[SET_STORY_POSITION_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_STORY_POSITION_CALLBACK)) hashMap[GET_STORY_ID_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, GET_STORY_ID_CALLBACK)) hashMap[GET_STORY_TIMELINE_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, GET_STORY_TIMELINE_CALLBACK)) hashMap[GET_LAYOUT_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, GET_LAYOUT_CALLBACK)) hashMap[SET_LAYOUT_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_LAYOUT_CALLBACK)) hashMap[SET_CTA_LABEL_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, SET_CTA_LABEL_CALLBACK)) hashMap[GET_STORY_METADATA_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, GET_STORY_METADATA_CALLBACK)) hashMap[LISTEN_FOR_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, LISTEN_FOR_CALLBACK)) hashMap[LISTEN_FOR_MORE_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, LISTEN_FOR_MORE_CALLBACK)) hashMap[REMOVE_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, REMOVE_CALLBACK)) hashMap[ON_PLAYER_EVENT_CALLBACK] = MapBuilder.of(PHASED_REGISTRATION_NAMES, MapBuilder.of(BUBBLED, ON_PLAYER_EVENT_CALLBACK)) return hashMap } override fun receiveCommand(root: PlayspacePlayer, commandId: Int, args: ReadableArray?) { super.receiveCommand(root, commandId, args) if (args == null) { return } when (commandId) { SET_PLAYSPACE_CONFIG_COMMAND -> { try { val config = args.getString(0) val json = Json { ignoreUnknownKeys = true } val playerConfig: PlayspaceConfig = json.decodeFromString(config) playerConfig._appSettings.reactNativeSdkVersion = "2.4.10" root.setConfig(playerConfig) invokeCallback(root.id, SET_PLAYSPACE_CONFIG_CALLBACK, null, true) } catch (exception: Exception) { invokeCallback(root.id, SET_PLAYSPACE_CONFIG_CALLBACK, exception.message, null) } } STOP_PLAYER_COMMAND -> { root.stopPlayer() } PLAY_COMMAND -> { root.play(object : PlayListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, PLAY_CALLBACK, exception.message, null) } }) } PAUSE_COMMAND -> { root.pause(object : PauseListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, PAUSE_CALLBACK, exception.message, null) } }) } SET_VOLUME_COMMAND -> { try { val volume = args.getDouble(0).toFloat() root.setVolume(volume, object : SetVolumeListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, SET_VOLUME_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_VOLUME_CALLBACK, exception.message, null) } } SET_QUALITY_COMMAND -> { try { val videoQuality = args.getInt(0) val quality = VideoQuality.fromInt(videoQuality) root.setQuality(quality, object : SetQualityListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, SET_QUALITY_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_QUALITY_CALLBACK, exception.message, null) return } } GET_QUALITY_COMMAND -> { root.getQuality(object : GetQualityListener { override fun onResult(videoQuality: VideoQuality) { invokeCallback(root.id, GET_QUALITY_CALLBACK, null, videoQuality.value) } override fun onException(exception: BaseAPIException) { invokeCallback(root.id, GET_QUALITY_CALLBACK, exception.message, null) } }) } DISABLE_ADVERTISING_COMMAND -> { root.disableAdvertising(object : DisableAdvertisingListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, DISABLE_ADVERTISING_CALLBACK, exception.message, null) } }) } ENABLE_ADVERTISING_COMMAND -> { root.enableAdvertising(object : EnableAdvertisingListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, ENABLE_ADVERTISING_CALLBACK, exception.message, null) } }) } SET_MACROS_COMMAND -> { try { val macrosJsonString = args.getString(0) val macros = JSONObject(macrosJsonString) root.setMacros(macros, object : SetMacrosListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, SET_MACROS_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_MACROS_CALLBACK, exception.message, null) } } SET_PRE_ROLL_BREAK_COMMAND -> { try { val seconds = args.getInt(0) root.setPreRollBreak(seconds, object : SetPreRollBreakListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, SET_PRE_ROLL_BREAK_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_PRE_ROLL_BREAK_CALLBACK, exception.message, null) } } SET_POST_ROLL_BREAK_COMMAND -> { try { val seconds = args.getInt(0) root.setPostRollBreak(seconds, object : SetPostRollBreakListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, SET_POST_ROLL_BREAK_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_POST_ROLL_BREAK_CALLBACK, exception.message, null) } } ADD_FRIENDLY_OBSTRUCTION_COMMAND -> { try { val obstructionReactTag = args.getInt(0) val purpose = args.getString(1).toObstructionPurpose() val detailedReason = args.getString(2) UIManagerHelper.getUIManager(context, UIManagerType.DEFAULT)?.resolveView(obstructionReactTag)?.let { obstructionView -> root.addFriendlyObstruction(obstructionView, purpose, detailedReason, object : AddFriendlyObstructionListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, ADD_FRIENDLY_OBSTRUCTION_CALLBACK, exception.message, null) } }) } } catch (exception: Exception) { invokeCallback(root.id, ADD_FRIENDLY_OBSTRUCTION_CALLBACK, exception.message, null) } } REMOVE_FRIENDLY_OBSTRUCTION_COMMAND -> { try { val obstructionReactTag = args.getInt(0) UIManagerHelper.getUIManager(context, UIManagerType.DEFAULT)?.resolveView(obstructionReactTag)?.let { obstructionView -> root.removeFriendlyObstruction(obstructionView, object : RemoveFriendlyObstructionListener { override fun onException(exception: BaseAPIException) { invokeCallback(root.id, REMOVE_FRIENDLY_OBSTRUCTION_CALLBACK, exception.message, null) } }) } } catch (exception: Exception) { invokeCallback(root.id, REMOVE_FRIENDLY_OBSTRUCTION_CALLBACK, exception.message, null) } } GET_STORY_POSITION_COMMAND -> { root.getStoryPosition(object : GetStoryPositionListener { override fun onResult(currentStoryPosition: Int) { invokeCallback(root.id, GET_STORY_POSITION_CALLBACK, null, currentStoryPosition) } override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, GET_STORY_POSITION_CALLBACK, exception.message, null) } }) } SET_STORY_POSITION_COMMAND -> { try { val index = args.getInt(0) root.setStoryPosition(index, object : SetStoryPositionListener { override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, SET_STORY_POSITION_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_STORY_POSITION_CALLBACK, exception.message, null) } } GET_STORY_ID_COMMAND -> { root.getStoryId(object : GetStoryIdListener { override fun onResult(storyId: String) { invokeCallback(root.id, GET_STORY_ID_CALLBACK, null, storyId) } override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, GET_STORY_ID_CALLBACK, exception.message, null) } }) } GET_STORY_TIMELINE_COMMAND -> { root.getStoryTimeline(object : GetStoryTimelineListener { override fun onResult(storyTimeline: List) { val storyTimelineInt = Arguments.createArray() var index = 0 while (index < storyTimeline.size) { storyTimelineInt.pushInt(storyTimeline[index]) index++ } invokeCallback(root.id, GET_STORY_TIMELINE_CALLBACK, null, storyTimelineInt) } override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, GET_STORY_TIMELINE_CALLBACK, exception.message, null) } }) } GET_LAYOUT_COMMAND -> { root.getLayout(object : GetLayoutListener { override fun onResult(layout: StoryLayout) { invokeCallback(root.id, GET_LAYOUT_CALLBACK, null, layout.value) } override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, GET_LAYOUT_CALLBACK, exception.message, null) } }) } SET_LAYOUT_COMMAND -> { try { val layoutType = args.getInt(0) val storyLayout = StoryLayout.fromInt(layoutType) root.setLayout(storyLayout, object : SetLayoutListener { override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, SET_LAYOUT_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_LAYOUT_CALLBACK, exception.message, null) } } SET_CTA_LABEL_COMMAND -> { try { val slideIndex = args.getInt(0) val label = args.getString(1) root.setCtaLabel(slideIndex, label, object : SetCtaLabelListener { override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, SET_CTA_LABEL_CALLBACK, exception.message, null) } }) } catch (exception: Exception) { invokeCallback(root.id, SET_CTA_LABEL_CALLBACK, exception.message, null) } } GET_STORY_METADATA_COMMAND -> { root.getStoryMetadata(object : GetStoryMetadataListener { override fun onResult(storyMetadata: List) { val result = Arguments.createArray() var index = 0 while (index < storyMetadata.size) { val dictionary = Arguments.createMap() val (title, duration, clickUrl) = storyMetadata[index] dictionary.putString(StoryMetadataKeys.TITLE, title) if (duration != null) { dictionary.putInt(StoryMetadataKeys.DURATION, duration) } dictionary.putString(StoryMetadataKeys.CLICK_URL, clickUrl) result.pushMap(dictionary) index++ } invokeCallback(root.id, GET_STORY_METADATA_CALLBACK, null, result) } override fun onException(exception: PlayspaceAPIException) { invokeCallback(root.id, GET_STORY_METADATA_CALLBACK, exception.message, null) } }) } LISTEN_FOR_COMMAND -> { try { val event = args.getString(0) val once = args.getBoolean(1) val eventType = fromString(event) root.listenFor(eventType, once) } catch (exception: Exception) { invokeCallback(root.id, LISTEN_FOR_CALLBACK, exception.message, null) } } LISTEN_FOR_MORE_COMMAND -> { try { val events = args.getArray(0) val eventsToListenTo = ArrayList() var index = 0 while (index < events.size()) { val event = events.getString(index) val eventType = fromString(event) eventsToListenTo.add(eventType) index++ } root.listenForMore(eventsToListenTo) } catch (exception: Exception) { invokeCallback(root.id, LISTEN_FOR_MORE_CALLBACK, exception.message, null) } } LISTEN_FOR_ALL_EVENTS_COMMAND -> { root.listenForAllEvents() } REMOVE_COMMAND -> { try { val event = args.getString(0) val eventType = fromString(event) root.remove(eventType) } catch (exception: Exception) { invokeCallback(root.id, REMOVE_CALLBACK, exception.message, null) } } REMOVE_ALL_EVENTS_COMMAND -> { root.removeAllEvents() } } } private fun invokeCallback(viewId: Int, callbackName: String, errorMessage: String?, result: Any?) { val map = Arguments.createMap() if (errorMessage != null) { map.putString(ERROR_KEY, errorMessage) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) return } if (result is Boolean) { map.putBoolean(RESULT_KEY, (result as Boolean?)!!) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) return } if (result is Int) { map.putInt(RESULT_KEY, (result as Int?)!!) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) return } if (result is Double) { map.putDouble(RESULT_KEY, (result as Double?)!!) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) return } if (result is ReadableArray) { map.putArray(RESULT_KEY, result as ReadableArray?) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) return } if (result is ReadableMap) { map.putMap(RESULT_KEY, result as ReadableMap?) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) return } if (result is String) { map.putString(RESULT_KEY, result as String?) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, callbackName, map) } } private fun onPlayerEvent(playerEvent: PlayerEvent, viewId: Int) { val key = playerEvent.component1().value val payload = playerEvent.component2() val params = Arguments.createMap() val readableMap: ReadableMap = Arguments.makeNativeMap(payload) params.putMap(key, readableMap) context.getJSModule(RCTEventEmitter::class.java).receiveEvent(viewId, ON_PLAYER_EVENT_CALLBACK, params) } private fun String.toObstructionPurpose(): ObstructionPurpose { when (this) { "videoControls" -> return ObstructionPurpose.VIDEO_CONTROLS "closeAd" -> return ObstructionPurpose.CLOSE_AD "notVisible" -> return ObstructionPurpose.NOT_VISIBLE } return ObstructionPurpose.OTHER } companion object { internal object StoryMetadataKeys { const val TITLE = "title" const val DURATION = "duration" const val CLICK_URL = "clickUrl" } private const val PHASED_REGISTRATION_NAMES = "phasedRegistrationNames" private const val BUBBLED = "bubbled" private const val ERROR_KEY = "error" private const val RESULT_KEY = "result" private const val SET_PLAYSPACE_CONFIG_METHOD = "setPlayspaceConfig" private const val SET_PLAYSPACE_CONFIG_CALLBACK = "onSetPlayspaceConfig" private const val SET_PLAYSPACE_CONFIG_COMMAND = 6000 private const val STOP_PLAYER_METHOD = "stopPlayer" private const val STOP_PLAYER_COMMAND = 6001 private const val PLAY_METHOD = "play" private const val PLAY_CALLBACK = "onPlay" private const val PLAY_COMMAND = 6002 private const val PAUSE_METHOD = "pause" private const val PAUSE_CALLBACK = "onPause" private const val PAUSE_COMMAND = 6003 private const val SET_VOLUME_METHOD = "setVolume" private const val SET_VOLUME_CALLBACK = "onSetVolume" private const val SET_VOLUME_COMMAND = 6004 private const val SET_QUALITY_METHOD = "setQuality" private const val SET_QUALITY_CALLBACK = "onSetQuality" private const val SET_QUALITY_COMMAND = 6005 private const val GET_QUALITY_METHOD = "getQuality" private const val GET_QUALITY_CALLBACK = "onGetQuality" private const val GET_QUALITY_COMMAND = 6006 private const val DISABLE_ADVERTISING_METHOD = "disableAdvertising" private const val DISABLE_ADVERTISING_CALLBACK = "onDisableAdvertising" private const val DISABLE_ADVERTISING_COMMAND = 6007 private const val ENABLE_ADVERTISING_METHOD = "enableAdvertising" private const val ENABLE_ADVERTISING_CALLBACK = "onEnableAdvertising" private const val ENABLE_ADVERTISING_COMMAND = 6008 private const val SET_MACROS_METHOD = "setMacros" private const val SET_MACROS_CALLBACK = "onSetMacros" private const val SET_MACROS_COMMAND = 6009 private const val SET_PRE_ROLL_BREAK_METHOD = "setPreRollBreak" private const val SET_PRE_ROLL_BREAK_CALLBACK = "onSetPreRollBreak" private const val SET_PRE_ROLL_BREAK_COMMAND = 6010 private const val SET_POST_ROLL_BREAK_METHOD = "setPostRollBreak" private const val SET_POST_ROLL_BREAK_CALLBACK = "onSetPostRollBreak" private const val SET_POST_ROLL_BREAK_COMMAND = 6011 private const val ADD_FRIENDLY_OBSTRUCTION_METHOD = "addFriendlyObstruction" private const val ADD_FRIENDLY_OBSTRUCTION_CALLBACK = "onAddFriendlyObstruction" private const val ADD_FRIENDLY_OBSTRUCTION_COMMAND = 6012 private const val REMOVE_FRIENDLY_OBSTRUCTION_METHOD = "removeFriendlyObstruction" private const val REMOVE_FRIENDLY_OBSTRUCTION_CALLBACK = "onRemoveFriendlyObstruction" private const val REMOVE_FRIENDLY_OBSTRUCTION_COMMAND = 6013 private const val GET_STORY_POSITION_METHOD = "getStoryPosition" private const val GET_STORY_POSITION_CALLBACK = "onGetStoryPosition" private const val GET_STORY_POSITION_COMMAND = 8000 private const val SET_STORY_POSITION_METHOD = "setStoryPosition" private const val SET_STORY_POSITION_CALLBACK = "onSetStoryPosition" private const val SET_STORY_POSITION_COMMAND = 8001 private const val GET_STORY_ID_METHOD = "getStoryId" private const val GET_STORY_ID_CALLBACK = "onGetStoryId" private const val GET_STORY_ID_COMMAND = 8002 private const val GET_STORY_TIMELINE_METHOD = "getStoryTimeline" private const val GET_STORY_TIMELINE_CALLBACK = "onGetStoryTimeline" private const val GET_STORY_TIMELINE_COMMAND = 8003 private const val GET_LAYOUT_METHOD = "getLayout" private const val GET_LAYOUT_CALLBACK = "onGetLayout" private const val GET_LAYOUT_COMMAND = 8004 private const val SET_LAYOUT_METHOD = "setLayout" private const val SET_LAYOUT_CALLBACK = "onSetLayout" private const val SET_LAYOUT_COMMAND = 8005 private const val SET_CTA_LABEL_METHOD = "setCtaLabel" private const val SET_CTA_LABEL_CALLBACK = "onSetCtaLabel" private const val SET_CTA_LABEL_COMMAND = 8006 private const val GET_STORY_METADATA_METHOD = "getStoryMetadata" private const val GET_STORY_METADATA_CALLBACK = "onGetStoryMetadata" private const val GET_STORY_METADATA_COMMAND = 8007 private const val LISTEN_FOR_METHOD = "listenFor" private const val LISTEN_FOR_CALLBACK = "onListenFor" private const val LISTEN_FOR_COMMAND = 9000 private const val LISTEN_FOR_MORE_METHOD = "listenForMore" private const val LISTEN_FOR_MORE_CALLBACK = "onListenForMore" private const val LISTEN_FOR_MORE_COMMAND = 9001 private const val LISTEN_FOR_ALL_EVENTS_METHOD = "listenForAllEvents" private const val LISTEN_FOR_ALL_EVENTS_COMMAND = 9002 private const val REMOVE_METHOD = "remove" private const val REMOVE_CALLBACK = "onRemove" private const val REMOVE_COMMAND = 9003 private const val REMOVE_ALL_EVENTS_METHOD = "removeAllEvents" private const val REMOVE_ALL_EVENTS_COMMAND = 9004 private const val ON_PLAYER_EVENT_CALLBACK = "onPlayerEvent" } }