Set up Recommendations (Android v3)
Automate the generation of a playlist based on a seed video for your Android app.
If you have hundreds of videos hosted on or registered with your account, Recommendations automates the generation of a playlist based on a seed video and provides you options to customize the appearance and behavior of that playlist.
Requirements
In addition to the general Android SDK requirements, the following items are required to implement Recommendations.
Item | Notes |
---|---|
Android 4.4 (API level 19) | Your app must be leveraging at least this minimum OS version. |
50 videos (recommended) | This is the suggested minimum number of videos that should be in your JWP library. |
Recommendations feature | If this product is not already enabled in your account, contact your JWP representative. |
Configure the Recommendations display options
The following steps explain how to create the Recommendations overlay:
- Create a recommendations playlist in your JWP dashboard.
- After creating the recommendations playlist, on the DEVELOPER RESOURCES tab of the JWP dashboard, copy the JSON URL.
- In your app, use
Related.Config.Builder()
to create and name aRelatedConfig
object, for example,related
. - Add the JSON URL (
file
). Be sure to change the value of the?related_media_id=
query to match the media ID of theplaylistItem.file
URL. - (Optional) Define
autoPlayTimer
. This creates a break between the playback of videos and enables the countdown overlay to appear. The default value is10
(seconds). - (Optional) Define
onComplete
asRELATED_ON_COMPLETE_AUTOPLAY
. This property helps to extend a user's viewing session. - (Optional) Use
autoPlayMessage
property to define the message that displays when the countdown overlay appears. We suggest using__title__ will begin in xx seconds
.
The countdown message appears above the title and description of the next video to play. The default message is Next up in xx. xx
represents the number of seconds remaining in the countdown as defined by autoPlayTimer
.
8. Add related
to config
.
PlaylistItem playlistItem = new PlaylistItem.Builder()
.file("https://cdn.jwplayer.com/manifests/{media_id}.m3u8")
.image("https://www.mydomain.com/poster.jpg")
.title("Playlist-Item Title")
.description("Some really great content")
.build();
RelatedConfig related = new RelatedConfig.Builder()
.file("https://cdn.jwplayer.com/v2/playlists/{recommendations_id}?related_media_id={media_id}")
.autoPlayTimer(10)
.onComplete(RELATED_ON_COMPLETE_AUTOPLAY)
.autoPlayMessage("__title__ will begin in xx seconds")
.build();
List<PlaylistItem> playlist = new ArrayList<>();
playlist.add(playlistItem);
PlayerConfig config = new PlayerConfig.Builder()
.playlist(playlist)
.relatedConfig(related)
.build();
mPlayerView.setup(config);
Updated over 1 year ago