Class VideoPlayerUtilsKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Boolean shouldPlayVideo(Context $self, Boolean isLockScreen) Determines whether video playback should be allowed based on device state.
      final static MediaPlayer getMediaPlayerInstance(Context context) Creates a MediaPlayer instance appropriate for the current Android version.
      final static Unit setAudioFocusParams(MediaPlayer $self, AudioFocusManager audioFocusManager) Sets audio focus parameters on the MediaPlayer based on Android version.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • shouldPlayVideo

         final static Boolean shouldPlayVideo(Context $self, Boolean isLockScreen)

        Determines whether video playback should be allowed based on device state.

        This function checks the device's power state and lock screen status to determine if video playback should proceed. It considers whether the screen is on/interactive and whether lock screen playback is enabled.

        Parameters:
        isLockScreen - Whether lock screen video playback is enabled
        Returns:

        true if video should play, false otherwise

      • getMediaPlayerInstance

         final static MediaPlayer getMediaPlayerInstance(Context context)

        Creates a MediaPlayer instance appropriate for the current Android version.

        This function handles the creation of MediaPlayer instances across different Android API levels, using the context-based constructor for newer versions and the legacy constructor for older versions.

        Parameters:
        context - The Context for creating the MediaPlayer (used on API 34+)
        Returns:

        A new MediaPlayer instance

      • setAudioFocusParams

         final static Unit setAudioFocusParams(MediaPlayer $self, AudioFocusManager audioFocusManager)

        Sets audio focus parameters on the MediaPlayer based on Android version.

        This function configures the MediaPlayer's audio attributes for proper audio focus handling, using AudioAttributes for newer Android versions and legacy audio stream type for older versions.

        Parameters:
        audioFocusManager - The AudioFocusManager containing audio attributes