React Native THEOplayer SDK
    Preparing search index...

    Interface MediaControlAPI

    interface MediaControlAPI {
        setEnabled(enabled: boolean): void;
        setHandler(
            action: MediaControlAction,
            handler: MediaControlHandler | undefined,
        ): void;
    }
    Index
    • Enables or disables the media session for this player instance at runtime.

      Parameters

      • enabled: boolean

        Whether the media session should be enabled for this player.

      Returns void


      - This overrides the MediaControlConfiguration.mediaSessionEnabled value passed at creation time.
      - When multiple players are active, this can be used to designate a single "active" player that publishes media metadata (e.g. Now Playing info) and responds to remote control commands, while disabling the others.

    • Sets a handler for a media control action.

      Parameters

      • action: MediaControlAction

        The media control action to set the handler for.

      • handler: MediaControlHandler | undefined

        The handler function that will be called when the specified media control action is triggered. The handler receives the THEOplayer instance as an argument. Passing undefined removes any previously set handler for the action, restoring the player's default behaviour.

      Returns void