You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to show .jpeg images for 5 seconds, but they are just skipped when playing. Is it correct to use SingleSampleMediaSource for that purpose? How to do it right?
void setPlaylist(List<Track> playlist) {
MediaSource[] mediaSources = tracksToMediaSources(playlist);
MediaSource mediaSource = (mediaSources.length == 1)
? mediaSources[0]
: new ConcatenatingMediaSource(mediaSources);
player.prepare(mediaSource);
player.setVideoTextureView(textureView);
}
private MediaSource[] tracksToMediaSources(List<Track> playlist) {
int playlistSize = playlist.size();
MediaSource[] mediaSources = new MediaSource[playlistSize];
for (int i = 0; i < playlistSize; ++i) {
Track track = playlist.get(i);
Uri trackUri = Uri.parse(track.getUrl());
switch (track.getType()) {
case VIDEO:
mediaSources[i] = new ExtractorMediaSource(trackUri, provideDataSourceFactory(), provideExtractorsFactory(), null, null);
break;
case IMAGE:
//--???--> mediaSources[i] = new SingleSampleMediaSource(trackUri, provideDataSourceFactory(), Format.createImageSampleFormat(null, "image/jpeg", null, Format.NO_VALUE, null, null, null), 5000);
break;
}
}
return mediaSources;
}
The text was updated successfully, but these errors were encountered:
We do not provide any built in support for playback of images. You could potentially write your own custom renderer (e.g. ImageRenderer extends BaseRenderer) to provide direct support within the player, or just manage displaying of images yourself outside of the player.
I'm trying to show .jpeg images for 5 seconds, but they are just skipped when playing. Is it correct to use SingleSampleMediaSource for that purpose? How to do it right?
The text was updated successfully, but these errors were encountered: