Class VdoInitParams.Builder

  • All Implemented Interfaces:

    
    public class VdoInitParams.Builder
    
                        

    Builder class for constructing instances of VdoInitParams.

    The Builder class allows for a flexible configuration of the playback parameters. It includes methods to set the media's token, OTP, playback information, captions language, and various other options related to the playback experience. Note: For online playback, you should either use the setOtp and setPlaybackInfo methods together or use the setVideoId and setToken methods together.

    • Constructor Detail

      • VdoInitParams.Builder

        VdoInitParams.Builder()
    • Method Detail

      • setVideoId

         VdoInitParams.Builder setVideoId(String videoId)

        Sets the video ID for online playback. This method is used to set the video ID necessary for accessing media online.

        Parameters:
        videoId - the video ID.
        Returns:

        the Builder instance for method chaining.

      • setCustomPlayer

         VdoInitParams.Builder setCustomPlayer(String customPlayerId)

        Sets the custom player ID.

        Use this method to specify a custom player ID for the playback. This method replaces the deprecated setPlayerConfig method.

        Parameters:
        customPlayerId - the ID of the custom player to be set.
        Returns:

        the Builder instance for method chaining.

      • setOfflinePlayback

         VdoInitParams.Builder setOfflinePlayback(String mediaId)

        Enables offline playback for a specified media ID.

        This method sets up the player to use locally saved media files for playback.

        Parameters:
        mediaId - the ID of the media to be played offline.
        Returns:

        the Builder instance for method chaining.

      • enableOfflinePlayback

         VdoInitParams.Builder enableOfflinePlayback()

        Allows the player to use locally saved media files for playback.

        This method enables playback of media items that are saved locally without requiring a DRM license. Before using this method, ensure that a valid Token/OTP and Playback Info are provided using setToken and setPlaybackInfo. However, it is generally recommended to use setOfflinePlayback for offline playback, which should be handled with enqueueV2 for downloading media items.

        Returns:

        the Builder instance for method chaining.

      • setClips

         VdoInitParams.Builder setClips(int startTimeMs, int endTimeMs)

        Sets the start and end time for a media clip playback.

        This method allows you to specify a portion of the media to be played by defining the start time and the end time in milliseconds. The media will start playing from startTimeMs and will stop at endTimeMs.

        If startTimeMs is set to a value greater than or equal to endTimeMs, the entire media will be played.

        If not specified, the media will start from the beginning (0 ms) and play until the end.

        Parameters:
        startTimeMs - the start time of the media clip in milliseconds.
        endTimeMs - the end time of the media clip in milliseconds.
        Returns:

        the Builder instance for method chaining.

      • setResumeTime

         VdoInitParams.Builder setResumeTime(int resumeTimeMs)

        Sets the player resume time in milliseconds.

        By specifying a resume time, the player will resume playback from the given timestamp. Setting this will override any global settings related to auto resume.

        Parameters:
        resumeTimeMs - the resume time in milliseconds.
        Returns:

        the Builder instance for method chaining.

      • enableAutoResume

         VdoInitParams.Builder enableAutoResume()

        Enables automatic resume of playback from the last position.

        This method sets the player to automatically resume playback from the last known position when the media is reloaded. This setting overrides any global settings related to auto resume.

        Returns:

        the Builder instance for method chaining.

      • skipMedia3VersionCheck

         VdoInitParams.Builder skipMedia3VersionCheck()

        Skips the Media3 version check.

        This method allows the app to bypass the Media3 version check, which is useful if the app is using a different version of Media3 that may have API conflicts. Use this method when you need to ensure compatibility with other versions of Media3, especially if there are known conflicts or issues with the version currently in use.

        Returns:

        the Builder instance for method chaining.

      • setPlayerLanguage

         VdoInitParams.Builder setPlayerLanguage(String languageCode)

        Sets the language code for the player.

        This method specifies the language code to be used for the player's interface and any available subtitles or captions. The language code should follow the BCP 47 standard, such as "en" for English or "fr" for French.

        Parameters:
        languageCode - the language code to set for the player.
        Returns:

        the Builder instance for method chaining.

      • setToken

         VdoInitParams.Builder setToken(String token)

        Sets the token for online playback. This method is used to set the token for accessing media online.

        Parameters:
        token - the media access token.
        Returns:

        the Builder instance for method chaining.

      • setPlaybackInfo

        @Deprecated() VdoInitParams.Builder setPlaybackInfo(String playbackInfo)

        Sets the playback information for online playback. This method is used to set the playback information necessary for accessing media online.

        Parameters:
        playbackInfo - the playback information string.
        Returns:

        the Builder instance for method chaining.

      • setAutoplay

         VdoInitParams.Builder setAutoplay(boolean autoplay)

        Sets whether the player should autoplay when the media is ready.

        If autoplay is set to true, the media will automatically start playing when it is loaded and ready. If set to false, the media will require manual initiation to start playback.

        Parameters:
        autoplay - true to enable autoplay, false to disable it.
        Returns:

        the Builder instance for method chaining.

      • setPreferredCaptionsLanguage

         VdoInitParams.Builder setPreferredCaptionsLanguage(String preferredCaptionsLanguage)

        Sets the preferred captions language for the media.

        This method specifies the language to be used for captions, if available. The captions will be displayed in the preferred language if it is supported by the media.

        Parameters:
        preferredCaptionsLanguage - the preferred captions language as an ISO 639-1 language code (e.g., "en" for English).
        Returns:

        the Builder instance for method chaining.

      • setForceLowestBitrate

         VdoInitParams.Builder setForceLowestBitrate(boolean forceLowestBitrate)

        Sets whether to force the use of the lowest bitrate for video playback.

        If forceLowestBitrate is set to true, the player will prioritize using the lowest available video bitrate, which may help with streaming on slower network connections. If set to false, the player will use the default bitrate settings.

        Parameters:
        forceLowestBitrate - true to force the lowest bitrate, false otherwise.
        Returns:

        the Builder instance for method chaining.

      • setForceHighestSupportedBitrate

         VdoInitParams.Builder setForceHighestSupportedBitrate(boolean forceHighestSupportedBitrate)

        Sets whether to force the use of the highest supported bitrate for video playback.

        If forceHighestSupportedBitrate is set to true, the player will use the highest available video bitrate, which may provide better video quality at the cost of increased bandwidth usage. If set to false, the player will use the default bitrate settings.

        Parameters:
        forceHighestSupportedBitrate - true to force the highest bitrate, false otherwise.
        Returns:

        the Builder instance for method chaining.

      • setMaxVideoBitrateKbps

         VdoInitParams.Builder setMaxVideoBitrateKbps(int maxVideoBitrateKbps)

        Sets the maximum video bitrate in kilobits per second (kbps).

        This method limits the video bitrate to the specified value, which can help manage bandwidth usage and control video quality. If the specified value is less than the available bitrates, the player will use the closest lower bitrate.

        Parameters:
        maxVideoBitrateKbps - the maximum video bitrate in kilobits per second.
        Returns:

        the Builder instance for method chaining.

      • setTechOverride

         VdoInitParams.Builder setTechOverride(Array<String> techOverride)

        Sets the technology override for playback.

        This method allows specifying a list of technologies to be used for playback, overriding the default technology settings. If the provided array is null, an empty array will be used.

        Parameters:
        techOverride - an array of technology identifiers to override the default playback settings.
        Returns:

        the Builder instance for method chaining.

      • setDisableAnalytics

         VdoInitParams.Builder setDisableAnalytics(boolean disableAnalytics)

        Sets whether to disable analytics for playback.

        If disableAnalytics is set to true, analytics and tracking features will be disabled. If set to false, analytics will be enabled as per the global settings.

        Parameters:
        disableAnalytics - true to disable analytics, false to enable it.
        Returns:

        the Builder instance for method chaining.

      • setAllowAdbDebugging

         VdoInitParams.Builder setAllowAdbDebugging(boolean allowAdbDebugging)

        Sets whether to allow ADB (Android Debug Bridge) debugging during playback.

        When enabled, this option allows ADB debugging features to be used during playback, which can be useful for debugging and development purposes. By default, ADB debugging is disabled.

        Parameters:
        allowAdbDebugging - true to allow ADB debugging, false to disallow it.
        Returns:

        the Builder instance for method chaining.

      • setVdoMediaMetadata

         VdoInitParams.Builder setVdoMediaMetadata(VdoMediaMetadata vdoMediaMetadata)

        Sets the media metadata for the Vdo player.

        This method allows specifying additional metadata for the media being played. The provided VdoMediaMetadata object contains metadata such as title, description, and other relevant information that can be used during playback.

        Parameters:
        vdoMediaMetadata - the VdoMediaMetadata object containing media metadata.
        Returns:

        the Builder instance for method chaining.