Is it possible to set a still image with ExoPlayer? So I am trying to do something similar to what the Vimeo app is doing. If you have a video that is playing and you click the cast button to stream the video to a TV, the ExoPlayer switches to a still image, the audio on the phone doesn't play but the ProgressBar still updates and moves as the video is being streamed to a TV.
It's definitely possible. There's no requirement that you use any of the UI components provided by the ExoPlayer library, which means you can be in complete control of the UI if you prefer. Are you referring specifically to the ability to display an image instead of the video in SimpleExoPlayerView? If so then will https://github.com/google/ExoPlayer/pull/2273 do what you need? Note that you'll need to implement the "cast bit" (i.e. using the cast SDK to start the remote playback, and stopping the local playback) yourself.
Yes i'm in the middle of implementing the Cast SDK part, I would like to display an image instead of the video while the video is being Cast. Looks like #2273 is an open issue, so at the moment is there no supported way of doing what I am looking for?
I also noticed that the Youtube app does something similar when you cast a video.
We're likely to merge #2273 into the dev branch shortly.
To answer your question: There's no built-in support until that change is merged, but that doesn't mean there's no way of doing what you're trying to do. As per my previous response, you can implement your own player view and put whatever views and logic you want into it (this is what YouTube do). You can then use your view instead of SimpleExoPlayerView. A simpler approach might be to override exo_simple_player_view.xml to include an extra view for containing the image. This blog post may be helpful.
Oh thats a good idea. I'm already customizing exo_playback_control_view.xml. And then i guess in order to not hear the audio i could just set the volume to 0.
The normal model for casting is that you send the media URL to the receiver application on the remote device and it streams the content directly. Hence the player on the mobile device should be completely stopped, and so you wouldn't need to mute the audio. You'd need to hook the player controls up to the cast SDK to have them control the remote device playback (which is something we'd like to make easier in the future, but for now is something you need to do yourself).
I don't know if the cast SDK also supports casting of a Surface or something. If it does and if that's the model you're using, then yes I guess you'd set the audio volume to 0 when in this mode.
So once the video is being cast, i would like to be able to play, pause, and move to a different point in the video by interacting with the progressbar, all while having some still image with no audio playing.
You'll need to work out how to manually hook up the playback control UI to the cast SDK to do that. When you're casting in the normal model there is no local playback on the device, so the playback controls aren't just going to work.
I've filed https://github.com/google/ExoPlayer/issues/2283 to track supporting this more easily/directly.
The codelabs shows how they handle casting
https://codelabs.developers.google.com/codelabs/cast-videos-android/#0
however it doesn't let you switch in and out of cast mode to continue playing locally where you left off, similar to how it works on YouTube and Vimeo.
I figured out how to customize all this in my project
https://github.com/lawloretienne/Loop/blob/6338b2023ea71882e61d75a3a023764ca7426929/app/src/main/java/com/etiennelawlor/loop/fragments/VideoDetailsFragment.java
I have customized the ExoPlayer by overriding the exo_playback_control_view.xml and the exo_simple_player_view.xml file. In the exo_simple_player_view.xml I added an ImageView with id exo_thumbnail because i tried to work with the other ImageView with id exo_artwork but was having issues.
Note that we've merged #2283 into the dev branch also.
Most helpful comment
We're likely to merge #2273 into the dev branch shortly.
To answer your question: There's no built-in support until that change is merged, but that doesn't mean there's no way of doing what you're trying to do. As per my previous response, you can implement your own player view and put whatever views and logic you want into it (this is what YouTube do). You can then use your view instead of
SimpleExoPlayerView. A simpler approach might be to overrideexo_simple_player_view.xmlto include an extra view for containing the image. This blog post may be helpful.