Specify playback start time (Android)

Define the location where playback of a media asset should begin.


In some use cases, you may not want playback to start at the beginning of a media asset. While not all features are supplied by the Android SDK, here are two possible use cases:

  • Continuing to consume a media asset that was previously started, but not completed
  • Sharing a link to a specific moment in a media asset

The startTime property enables you to define the number of seconds from the start of a media asset when playback should begin.



Add startTime to a PlaylistItem

Use the following steps to include this functionality in your app:

  1. Identify the number of seconds from the start of a media asset when playback should begin.

  2. Set the startTime for the PlaylistItem. The following code example shows how to set the startTime with the value captured in the previous step.

    PlaylistItem playlistItem = new PlaylistItem.Builder()
        .file("https://cdn.jwplayer.com/manifests/{MEDIA_ID}.m3u8")
        .startTime(20)
        .build();
    
    List<PlaylistItem> playlist = new ArrayList<>();
    playlist.add(playlistItem);
    PlayerConfig config = new PlayerConfig.Builder()
        .playlist(playlist)
        .build();
    mPlayer.setup(config);