简体   繁体   中英

What's the difference between ExoPlayer and SimpleExoPlayer?

I'm learning how to use Exoplayer and I've stumbled about this question. In an Exoplayer tutorial I've read:

"For the vast majority of use cases SimpleExoPlayer.Builder should be used. This builder returns SimpleExoPlayer, which extends ExoPlayer to add additional high level player functionality."

Which kind of high level player functionality is meant?

SimpleExoPlayer provides extra functionalities using ExoPlayer as base. For example, it provides a functionality to pause player automatically when audio is rerouted from a headset to device speakers. You can do it by simply passing true to the function setHandleAudioBecomingNoisy

simpleExoPlayer.setHandleAudioBecomingNoisy(true)

It also provides user ability to create an instance of ExoPlayer just by passing the context. It will use the default renderFactory, trackSelector, LoadControl etc. It provides basic properties like videoFormat, audioFormat, audioSessionId etc.

You can go through the SimpleExoPlayer.java to know more about it. Just CTRL+Click on the class name to open it's source.

ExoPlayer is just an interface that extends the interface Player . It just defines the skeleton of a player, not actually implement the logic of functionalities of the player. You can implement the interface ExoPlayer to create your own player.
SimpleExoPlayer is a class. It is the actual player that implements all the functionalities of the player which are defined in the interface BasePlayer . the BasePlayer also extends interface Player .
You should dive deep into ExoPlayer source code for more detail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM