Skip to content

Media Player Control (Seat)#

The MediaPlayerControl class allows the seatback monitor to listen to media player messages from the PED and the Seat service. The MediaPlayerControl.MediaPlayerControlListener is called when a media play, pause, launch, etc message is received from the PED and Seat service. The MediaPlayerControl sendNowplaying sends information to PED through the Seat service, such as content type and media URI, elapsed time, for the media currently playing.

MediaPlayerControl Object Initialization via Pairing#

Initialize the pairing service between the in-flight entertainment (IFE) system and the passenger’s device. This pairing allows the phone (PED) to interact with the seatback monitor, including managing the media player.

a. Property Declaration

private Pairing pairing;

b. Pairing Initialization

The following block initializes the seat pairing service, which is necessary for enabling communication between the PED and the seatback monitor

Pairing.initService(activity, new IInFlightCallback() {
            @Override
            public void onInitServiceComplete(Object o, String s) {
                Log.v(TAG, "onInitServiceComplete() " + s);
                pairing = (Pairing) o;
            }

            @Override
            public void onInitServiceFailed(String s, InFlight.Error error) {
                Log.e(TAG, "onInitServiceFailed() " + s);
            }
        }, inFlight);
  • Step 1: Initialize PairingService: Calls initService on the Pairing, passing a callback to handle successful initialization.

  • Step 2: Assign Pairing Instance: The Pairing object is stored in a class-level property called pairing. This allows other parts of the app to interact with the pairing service.

  • Step 3: setMediaPlayerControlListener: Use the pairing object to register the MediaPlayerControlListener. The pairing object provides the getMediaPlayerControl method, which returns the MediaPlayerControl object. Sets the MediaPlayerControlListener using the MediaPlayerControl object.

How do we send the current status of the media player from the seat to the PED and the Seat service?#

The sendNowPlaying method in the media control class is responsible for keeping the PED and seat service updated on the current media state of the seat media player. This includes information like the media URI, elapsed time, and playback state. It's crucial to send this information regardless of the device pairing status. The seat service relies on this data for various functionalities, such as handling playback completion and initiating commands to change media. e.g. If the playback completed state received by seat service, it changes the media and initiates a command for the player to change the media.

aero.panasonic.inflight.services.pairing.v1.MediaPlayerControl control = mPairing.getMediaPlayerControl();
        List<SeatMediaPlayerInfo> playerInfoList = new LinkedList<>();
        SeatMediaPlayerInfo seatMediaPlayerInfo = new SeatMediaPlayerInfo();
        seatMediaPlayerInfo.setPlayerId("MediaQueuePlayer");
        seatMediaPlayerInfo.setSubtitle("eng");
        seatMediaPlayerInfo.setSubtitleType("description");
        seatMediaPlayerInfo.setSoundtrack("jpn");
        seatMediaPlayerInfo.setSoundtrackType("dialog");
        seatMediaPlayerInfo.setCurrentPlayingMediaUri("media:abc12345678a");
        seatMediaPlayerInfo.setContentType("video");
        seatMediaPlayerInfo.setElapsedTime(200);
        seatMediaPlayerInfo.setDuration(5000);
        seatMediaPlayerInfo.setVolume(50);
        playerInfoList.add(seatMediaPlayerInfo);
        control.sendNowplaying(playerInfoList);

How does MediaPlayerControl get events from PED & Seat service?#

The MediaPlayerControl class has a method called setMediaPlayerControlListener. We must implement the MediaPlayerControlListener interface, which has various methods to handle events triggered by the PED and the seat service.

1. onNowPlayingRequestReceived(String s)

The method is called when the MediaPlayerControl’s sendNowPlaying() sends the requested player info

@Override
public void onNowPlayingRequestReceived(String s) {

}

Parameter :

playerId: Unique identifier for the media player. If playerId is specified, only the specified player information is sent. If the playerId is null, information is sent for all the players.

2. onLaunchMediaRequestReceived(LaunchMediaRequest request)

The method is called when the PED or seat service triggers a media launch request. After receiving this request, the interactive has to start the play the media, which details obtained using the LaunchMediaRequest object.

@Override
public void onLaunchMediaRequestReceived(LaunchMediaRequest launchMediaRequest) {
 launchMediaRequest.getMediaUri();
 launchMediaRequest.getPlayerId();
 launchMediaRequest.getContentType();
 launchMediaRequest.getParentMediaUri();
 launchMediaRequest.getElapsedTime();
 launchMediaRequest.getSoundtrack();
 launchMediaRequest.getSoundtrackType();
 launchMediaRequest.getSubtitle();
 launchMediaRequest.getSubtitleType();
 launchMediaRequest.getCategoryId();
 launchMediaRequest.getCategoryId();
}

Parameter:

launchMediaRequest: The LaunchMediaRequest class object provides all the necessary information to play media on the seat.

3. onPlayRequestReceived(String playerId)

The method is called when a play request triggers from the PED. It is an event from the PED to the Seat. We need to send a play command to the player explicitly.

@Override
public void onPlayRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

4. onPauseRequestReceived(String playerId)

The method is called when a pause request triggers from the PED. The interactive will send a pause command to the player.

@Override
public void onPauseRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

5. onStopRequestReceived(String playerId)

The method is called when a stop request triggers from the PED. The interactive will send the stop command to the player.

@Override
public void onStopRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

6. onNextRequestReceived(String playerId)

The method is called when the next request triggers from the PED.

@Override
public void onNextRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

7. onPreviousRequestReceived(String playerId)

The method is called when a previous request triggers from the PED.

@Override
public void onPreviousRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

8. onStepForwardRequestReceived(String playerId)

The method is called when a forward request triggers from the PED. It is an event from PED to the seat, the forward duration has to be defined on the interactive side.

@Override
public void onStepForwardRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

9. onStepBackwardRequestReceived(String playerId)

The method is called when a backward request triggers from the PED. It is an event from PED to the seat, the backward duration has to be defined on the interactive side.

@Override
public void onStepBackwardRequestReceived(String s) {
}

Parameter:

playerId: Unique identifier for the media player.

10. onSeekToRequestReceived(String playerId, int position)

The method is called when a seek request triggers from the PED.

@Override
public void onSeekToRequestReceived(String s, int i) {
}

Parameter:

  • playerId: Unique identifier for the media player.

  • position: The position that has to be set in the player.

11. onSetVolumeRequestReceived(String playerId, int volume)

The method is called when a volume request triggers from the PED.

@Override
public void onSetVolumeRequestReceived(String s, int i) {
}

Parameter:

  • playerId: Unique identifier for the media player.

  • volume: The Step value is specified as 0 to 100

12. void onVolumeUpRequestReceived(String playerId, int step)

The method is called when a volume-up request triggers from the PED.

@Override
public void onVolumeUpRequestReceived(String s, int i) {
}

Parameter:

  • playerId: Unique identifier for the media player.

  • step: The step value is specified as 0 to 100

13. void onVolumeDownRequestReceived(String playerId, int step)

The method is called when a volume-down request triggers from the PED.

@Override
public void onVolumeDownRequestReceived(String s, int i) {
}

Parameter:

  • playerId: Unique identifier for the media player.

  • step: Volume value is specified as 1 to 100

14. onSetSubtitleRequestReceived(String playerId, String subtitle, String subtitleType)

The method is called when a subtitle change request triggers from the PED.

@Override
public void onSetSubtitleRequestReceived(String s, String s1, String s2) {
}

Parameter:

  • playerId: Unique identifier for the media player.

  • subtitle: ISO-639-2 language code for the media subtitle

  • subtitleType: type of subtitle e.g. description, dialog etc.

15. void onSetSoundtrackRequestReceived(String playerId, String soundtrack, String soundtrackType)

The method is called when a soundtrack change request triggers from the PED.

@Override
public void onSetSoundtrackRequestReceived(String s, String s1, String s2) {
}

Parameter:

  • playerId: Unique identifier for the media player

  • soundtrack: ISO-639-2 language code for the media soundtrack

  • soundtrackType: type of soundtrack e.g. description, dialog etc.

Version 1.0