android / codelab-exoplayer-intro

Media Streaming with ExoPlayer codelab
https://codelabs.developers.google.com/codelabs/exoplayer-intro
Apache License 2.0
221 stars 116 forks source link

Specify AudioAttributes for all playback scenarios #41

Open dturner opened 5 years ago

dturner commented 5 years ago

From Andrew:

With audio focus handling, it's now possible for the player to have playWhenReady true and player state READY, but not actually to be playing: https://github.com/google/ExoPlayer/blob/r2.10.5/library/core/src/main/java/com/google/android/exoplayer2/Player.java#L623

I think it's okay to leave this as it is because audio focus handling isn't enabled in this tutorial, but on the other hand the new method is quite easy to use so I wonder if we should be directing people to that. (Side note: I think it's also good practice to specify AudioAttributes for all playbacks, but the tutorial doesn't do that at the moment; if it did, then we'd also need to pass a boolean setting whether to enable/disable audio focus handling as ExoPlayer has a combined setter for both.)

dturner commented 4 years ago

Need to use ExoPlayer's AudioAttributes class rather than the media API.