A video program's attributes depend on the type of its content. The program type tells the system what metadata to expect so that the UI can be filled in appropriately. Video programs can be one of these types:
Use PreviewProgram.Builder to build a program. You can read more about possible values for each field in the reference docs for each setter on the builder.
Kotlin
val program = PreviewProgram.Builder() .setChannelId(channelId) .setTitle(clip.getTitle()) .setDescription(clip.getDescription()) .setType(TvContractCompat.PreviewPrograms.TYPE_MOVIE) // Set required attributes .build()
Java
PreviewProgram program = new PreviewProgram.Builder() .setChannelId(channelId) .setTitle(clip.getTitle()) .setDescription(clip.getDescription()) .setType(TvContractCompat.PreviewPrograms.TYPE_MOVIE) // Set required attributes .build();
The following table shows the attributes that can be assigned to each type of video program and links to the corresponding setter in PreviewProgram.Builder. Attributes marked ✔ are required, those marked (✔) are optional:
Attribute | Movie | TV Series | TV Season | TV Episode | Clip | Event | Channel |
---|---|---|---|---|---|---|---|
Author | (✔) | ||||||
Availability | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Canonical Genres | (✔) | (✔) | (✔) | (✔) | |||
Channel ID | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Content ID | (✔) | ||||||
Content Ratings | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
DurationMillis | ✔ | ✔ | ✔ | (✔) | |||
Episode Number | ✔ | ||||||
Episode Title | (✔) | ||||||
Genre | (✔) | (✔) | (✔) | (✔) | |||
Intent URI | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Interaction Count | (✔) | (✔) | |||||
Interaction Type | (✔) | (✔) | |||||
Internal Provider ID | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Item Count | (✔) | (✔) | |||||
Live | (✔) | (✔) | (✔) | (✔) | (✔) | ||
Logo URI (*) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Logo Content Description (*) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Offer Price | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Poster Art Aspect Ratio | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Poster Art URI | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Preview Video URI | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Release Date | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | |
Review Rating | (✔) | (✔) | (✔) | (✔) | (✔) | ||
Review Rating Style | (✔) | (✔) | (✔) | (✔) | (✔) | ||
Season Display Number | ✔ | ✔ | |||||
Short Description | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Start Time UTC Millis (*) | ✔ | ✔ | ✔ | ✔ | |||
End Time UTC Millis (*) | ✔ | ✔ | ✔ | ✔ | |||
Starting Price | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Thumbnail Aspect Ratio | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Thumbnail URI | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Title | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Video Height | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Video Width | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Weight | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) | (✔) |
Preview images
The recommended sizes for preview images are:
Attribute | Aspect Ratio | Width | Height |
ASPECT_RATIO_16_9 | 16:9 | 272dp | 153dp |
ASPECT_RATIO_3_2 | 3:2 | 229.5dp | 153dp |
ASPECT_RATIO_4_3 | 4:3 | 204dp | 153dp |
ASPECT_RATIO_1_1 | 1:1 | 153dp | 153dp |
ASPECT_RATIO_2_3 | 2:3 | 102dp | 153dp |
ASPECT_RATIO_MOVIE_POSTER | 1:1.441 | 106dp | 153dp |
For best quality, preview videos should be 16:9 or 4:3 and at least the sizes specified in the table above. The logo should also be opaque for the best user experience.
You can specify the exact preview video sizes using VIDEO_WIDTH and VIDEO_HEIGHT.