Media in Native Android Environments
In Native Android environments, the following native methods allow for managing audio and video media.
There is a system limit of three simultaneous video surfaces.
Supported Android Method Calls
General Audio and Video
| Action | Audio/Video | MediaPlayer Methods |
|---|---|---|
| Get duration of a program | Audio | getDuration() |
| Launching and starting play in MediaPlayer instance | Audio, Video |
Refer to Media URIs and Formats for URI formats.
|
| Pause playback | Audio | pause() |
| Resume playback | Audio | start() |
| Fast-forward or rewind | Audio |
|
| Automatically play the next program | Audio | setLooping(boolean looping)(boolean
looping) |
| Set or remove an audio track | Audio, Video | |
| Set or disable subtitles | Video |
|
| Stop playback | Audio, Video | stop() |
| Close a MediaPlayer instance | Audio, Video | release() |
| Set the player to looping | Audio | setLooping(boolean looping) |
| Determine if the player is set to looping | Audio | isLooping() |
| Determine if the player is playing | Audio, Video | isPlaying() |
4K Media Player
| Action | Audio/Video | MediaPlayer Methods |
|---|---|---|
| Set the video view size to ensure the size does not scale down | Video | setSurface(Surface surface) |
Media Listener
MediaPlayer listeners:
setOnCompletionListener(MediaPlayer.OnCompletionListener listener)setOnErrorListener(MediaPlayer.OnErrorListener listener)setOnPreparedListener(MediaPlayer.OnPreparedListener listener)setOnSeekCompleteListener(MediaPlayer.OnSeekCompleteListener listener)setOnVideoSizeChangedListener(MediaPlayer.OnVideoSizeChangedListener listener)
Media URIs and Formats
The following URIs are used with the
setDataSource MediaPlayer
method.
The Category ID (
cid:<\CID>\) is optional. Category ID is used for PAXUS logging.Use Panasonic media streaming protocols, such as
pac_rtp://orpac_rtsp://, with the Native Android media player. The DRM is handled by the headend streamer Widevine and Fairplay DRM services component.
| Type | Format | Example |
|---|---|---|
RTP IP Broadcast media by IP | pac_rtp://<ip>:<port>[cid:<CID>] | pac_rtp://239.192.3.77:52220 |
RTP IP Audio only | pac_rtp://audio:<ip>:<port>[cid:<CID>] | pac_rtp://audio:239.192.3.77:52220 |
RTP IP Video only | pac_rtp://video:<ip>:<port>[cid:<CID>] | pac_rtp://video:239.192.3.77:52220 |
RTP Channel Broadcast media by channel | pac_rtp://audio:<channel>[cid:<CID>]
or
pac_rtp://video:<channel>[cid:<CID>] | pac_rtp://audio:1 |
RTSP MID AVOD by MID | pac_rtsp://mid:<MID>[cid:<CID>] | pac_rtsp://mid:100002:cid:3 |
RTSP MID Audio only | pac_rtsp://audio:mid:<MID>[cid:<CID>] | pac_rtsp://audio:mid:1001:cid:3 |
RTSP MID Video only | pac_rtsp://video:mid:<MID>[cid:<CID>] | pac_rtsp://video:mid:1001:cid:7 |
RTSP File AVOD by file | pac_rtsp://file:<file_name> | pac_rtsp://file:movie03.mpg |
| HDMI input | pac_aux://hdmi:<type> |
pax_aux://hdmi:audio_video
|
| HLS | pac_hls:// |
Unsupported Android Methods
The following Android MediaPlayer methods
are explicitly not supported:
addTimedTextSource(Context context, Uri uri, String mimeType)addTimedTextSource(String path, String mimeType)addTimedTextSource(FileDescriptor fd, long offset, long length, String mimeType)addTimedTextSource(FileDescriptor fd, String mimeType)attachAuxEffect(int effectId)create(Context context, int resid)setAudioSessionId(int sessionId)setAudioStreamType(int streamType)setAuxEffectSendLevel(float level)setDataSource(String path)setDataSource(Context context, Uri uri, Map<String, String> headers)setDataSource(FileDescriptor fd, long offset, long length)setDataSource(FileDescriptor fd)setOnBufferingUpdateListener(MediaPlayer.OnBufferingUpdateListener listener)setOnInfoLIstener(MediaPlayer.OnInfoListener listener)setOnTimedTextListener(MediaPlayer.OnTimedTextListener listener)setVolume(float leftVolume, float rightVolume)setWakeMode(Context context, int mode)