Package 

Interface Player

    • Constructor Detail

    • Method Detail

      • getAds

        @NonNull() abstract Ads getAds()

        The ads API.

        • Only available with the feature 'ads'.
      • getDuration

         abstract double getDuration()

        The duration of the media, in seconds.

        • On source change, duration becomes available after the getReadyState becomes HAVE_METADATA.
      • isAutoplay

         abstract boolean isAutoplay()

        Returns whether the player should immediately start playback after source change.

        • To autoplay without sound, setMuted must be configured with 'true'.
      • setAutoplay

         abstract void setAutoplay(boolean autoplay)

        Sets whether the player should immediately start playback after source change.

        • The execution of the method will be done asynchronously.
        Parameters:
        autoplay - Indicates whether the player should automatically play.
      • setAutoplay

        @Deprecated() abstract void setAutoplay(boolean autoplay, @Nullable() DoneCallback callback)

        Sets whether the player should immediately start playback after source change.

        Parameters:
        autoplay - Indicates whether the player should automatically play.
        callback - The DoneCallback which will be called when the execution is completed.
      • getVolume

         abstract double getVolume()

        The volume of the audio.

        • This volume is completely separated from the Android device volume.
        • The volume heard will be a combination of the player volume and the Android device volume.
      • setVolume

         abstract void setVolume(double volume)

        Sets the volume of the audio.

        • The execution of the method will be done asynchronously.
        • This volume is completely separated from the Android device volume.
        • The volume heard will be a combination of the player volume and the Android device volume.
        Parameters:
        volume - The new volume of the audio, represented by a rational number between 0 and 1.
      • setVolume

        @Deprecated() abstract void setVolume(double volume, @Nullable() DoneCallback callback)

        Sets the volume of the audio.

        Parameters:
        volume - The new volume of the audio, represented by a rational number between 0 and 1.
        callback - The DoneCallback which will be called when the execution is completed.
      • setPreload

         abstract void setPreload(@NonNull() PreloadType preload)

        Sets the PreloadType of the player.

        • The execution of the method will be done asynchronously.
        Parameters:
        preload - The new preload type.
      • isMuted

         abstract boolean isMuted()

        Returns whether the audio is muted.

      • setMuted

         abstract void setMuted(boolean muted)

        Sets whether the audio is muted.

        • This affects capabilities of isAutoplay.
        • The execution of the method will be done asynchronously.
        Parameters:
        muted - Whether the audio is muted.
      • setMuted

        @Deprecated() abstract void setMuted(boolean muted, DoneCallback callback)

        Sets whether the audio is muted.

        Parameters:
        muted - Whether the audio is muted.
        callback - The DoneCallback which will be called when the execution is completed.
      • isSeeking

         abstract boolean isSeeking()

        Returns whether the player is seeking.

      • getSrc

        @Nullable() abstract String getSrc()

        The current URL of the media.

        • Prefer getSource instead, as it contains a more detailed description regarding ads, analytics etc.
      • setSrc

         abstract void setSrc(@Nullable() String src)

        Sets a new media source URL.

        • The execution of the method will be done asynchronously.
        Parameters:
        src - The new media source URL.
      • isPaused

         abstract boolean isPaused()

        Returns whether the player is paused.

      • isEnded

         abstract boolean isEnded()

        Returns whether playback of the media has ended.

        • Playback had ended when the current playback position is at the end of the media and the player does not loop.
      • play

         abstract void play()

        Starts or resumes playback.

        • The execution of the method will be done asynchronously.
        • When the player is not paused this method has no effect.
      • pause

         abstract void pause()

        Pauses playback.

        • The execution of the method will be done asynchronously.
      • stop

         abstract void stop()

        Stops playback.

        • The execution of the method will be done asynchronously.
      • getCurrentTime

         abstract double getCurrentTime()

        Returns the current playback position of the media, in seconds.

      • getMetrics

        @Nullable() abstract Metrics getMetrics()

        Get the current Metrics of the player.

        • The values will be updated periodically.
        • If the metrics are not yet known, it returns null.
      • getError

        @Nullable() abstract String getError()

        The last error that occurred for the current source, if any.

      • setPlaybackRate

         abstract void setPlaybackRate(double playbackRate)

        Sets the playback rate of the media.

        • The execution of the method will be done asynchronously.
        • Playback rate is represented by a number where `1` is default playback speed.
        • It is recommended that you limit the range to between 0.5 and 4.

        Example:

        • `playbackRate = 0.70` will slow down the playback rate of the media by 30%.
        • `playbackRate = 1.25` will speed up the playback rate of the media by 25%.
        Parameters:
        playbackRate - The new playback rate, represented by a number where `1` is default playback speed.
      • setPlaybackRate

        @Deprecated() abstract void setPlaybackRate(double playbackRate, @Nullable() DoneCallback callback)

        Sets the playback rate of the media.

        Parameters:
        playbackRate - The new playback rate, represented by a number where `1` is default playback speed.
        callback - The DoneCallback which will be called when the execution is completed.
      • setCurrentProgramDateTime

         abstract void setCurrentProgramDateTime(Date currentProgramDateTime)

        Sets the current program date time.

        • The execution of the method will be done asynchronously.
        • When the program date time information is not embedded in the manifest, the current program date time will not be set.
        Parameters:
        currentProgramDateTime - The new current program date time.
      • getVideoHeight

         abstract int getVideoHeight()

        Returns the height of the active video rendition, in pixels.

      • getVideoWidth

         abstract int getVideoWidth()

        Returns the width of the active video rendition, in pixels.

      • setCurrentTime

         abstract void setCurrentTime(double currentTime)

        Sets the playback position of the media.

        • The execution of the method will be done asynchronously.
        Parameters:
        currentTime - The new playback position, in seconds.
      • setCurrentTime

        @Deprecated() abstract void setCurrentTime(double currentTime, @Nullable() DoneCallback callback)

        Sets the playback position of the media.

        Parameters:
        currentTime - The new playback position, in seconds.
        callback - The DoneCallback which will be called when the execution is completed.
      • getHespApi

        @Nullable() abstract HespApi getHespApi()

        The HESP API.

        • Note: This API is in an experimental stage and may be subject to breaking changes.
        • Only available with the feature 'hesp'.