Class NativeMediaPlayer
-
- All Implemented Interfaces:
-
com.inmobi.media.videoPlayer.MediaPlayer
public final class NativeMediaPlayer implements MediaPlayer
A class responsible for managing video playback in a native ad.
This class handles the lifecycle of a video player, including loading, playback, pausing, and completion. It also manages the audio focus, viewability, and progress tracking of the video.
-
-
Field Summary
Fields Modifier and Type Field Description private final Flow<VideoEvent>mediaPlayerFlow
-
Constructor Summary
Constructors Constructor Description NativeMediaPlayer(Context context, CoroutineScope coroutineScope, VideoPlayerConfig config, InMobiLogger logger)
-
Method Summary
Modifier and Type Method Description Flow<VideoEvent>getMediaPlayerFlow()A SharedFlow emitting VideoEvents. ViewGroupinflate(List<String> urls)Inflates the media player and loads the video from the provided URLs. Unitstart()Stops the video playback and related components. Unitstop()Stops the video playback and related components. Unitdestroy()Destroys the media player and releases resources. -
-
Constructor Detail
-
NativeMediaPlayer
NativeMediaPlayer(Context context, CoroutineScope coroutineScope, VideoPlayerConfig config, InMobiLogger logger)
-
-
Method Detail
-
getMediaPlayerFlow
Flow<VideoEvent> getMediaPlayerFlow()
A SharedFlow emitting VideoEvents.
-
inflate
ViewGroup inflate(List<String> urls)
Inflates the media player and loads the video from the provided URLs.
- Parameters:
urls- The list of video URLs to load.- Returns:
The ViewGroup containing the inflated media player.
-
start
Unit start()
Stops the video playback and related components.
This function stops the video progress tracker, detaches surface controller observers, and cancels any active coroutine jobs related to media playback.
-
stop
Unit stop()
Stops the video playback and related components.
This function stops the video progress tracker, detaches surface controller observers, and cancels any active coroutine jobs related to media playback.
-
-
-
-