Questions tagged [exoplayer2.x]

ExoPlayer 2.x is a major iteration of the ExoPlayer (an open source, application level media player built on top of Android’s low level media APIs) library with significant API and architectural improvements.

ExoPlayer 2.x includes significant architectural improvements of ExoPlayer and new features.

Key architectural changes:

  • Late binding between rendering and media source components. Allows the same rendering components to be re-used from one playback to another. Enables features such as gapless playback through playlists and DASH multi-period support.

  • Improved track selection design. More details can be found here.

  • LoadControl now used to control buffering and loading across all playback types.

  • Media source components given additional structure. A new MediaSource class has been introduced. MediaSources expose Timelines that describe the media they expose, and can consist of multiple MediaPeriods. This enables features such as seeking in live playbacks and DASH multi-period support.

  • Responsibility for loading the initial DASH/SmoothStreaming/HLS manifest is promoted to the corresponding MediaSource components and is no longer the application's responsibility.

  • Higher level abstractions such as SimpleExoPlayer have been added to the library. These make the library easier to use for common use cases. The demo app is halved in size as a result, whilst at the same time gaining more functionality. Read more here.

  • Enhanced library support for implementing audio extensions.

  • Format and MediaFormat are replaced by a single Format class.

Key new features:

  • Playlist support. Includes support for gapless playback between playlist items and consistent application of LoadControl and TrackSelector policies when transitioning between items.

  • Seeking in live playbacks for DASH and SmoothStreaming.

  • DASH multi-period support.

  • MediaSource composition allows MediaSources to be concatenated into a playlist, merged and looped.

  • Looping support.

  • Ability to query information about all tracks in a piece of media (including those not supported by the device).

  • Improved player controls.

  • Support for PSSH in fMP4 moof atoms.

  • Support for Opus in Ogg.

  • CacheDataSource support for standalone media file playbacks (mp3, mp4 etc).

  • FFMPEG extension (for audio only).

In case of building a new media app, recommend building it on ExoPlayer 2.X. For those who are using ExoPlayer 1.X, you can include both 1.X and 2.X in your app (due to a different package name), allowing you to test and migrate your users with minimal impact.

800 questions
5
votes
1 answer

Saving a video offline while playing in exoplayer

I am able to play the videos in exoplayer using the source code at https://github.com/google/ExoPlayer, but unable to find, how to save video and play later while offline. Also how segmented videos running through mpd files will be saved…
Hisham Muneer
  • 8,558
  • 10
  • 54
  • 79
5
votes
4 answers

Does SimpleExoPlayerView have controller visibility changed events?

I'm trying to implement a full screen mode with SimpleExoPlayerView. I've got this mostly working using setSystemUiVisibility. During onCreate i add a OnSystemUiVisibilityChange listener to sync hiding the player controls with the actionbar. …
Ryan Burnham
  • 573
  • 6
  • 15
5
votes
1 answer

MPEG-TS H.264 with ExoPlayer

I have two mpeg-ts + h.264 video files, which I attempt to read on an Android device (Samsung Tab A 10.1") with ExoPlayer: SimpleExoPlayerView view = new SimpleExoPlayerView(this); TrackSelection.Factory videoTrackSelectionFactory = new…
sdabet
  • 18,360
  • 11
  • 89
  • 158
5
votes
0 answers

Exoplayer2 - ConcatenatingMediaSource, duration of all sources

I have basic code for playing couple of audio files via exoplayer ExtractorMediaSource audioSource = new ExtractorMediaSource(uri, dataSourceFactory, extractor, null, null); ExtractorMediaSource audioSource2 = new ExtractorMediaSource(uri2,…
Marko Jovanović
  • 2,647
  • 3
  • 27
  • 36
5
votes
1 answer

Android - ExoPlayer2 subtitles

How to set subtitles on ExoPlayer2? I have tried this tu bild MergingMediaSource: SingleSampleMediaSource singleSampleSource = new SingleSampleMediaSource(Uri.fromFile(new File("/sdcard/Download/a.vtt")), mediaDataSourceFactory, …
TheModularMind
  • 2,024
  • 2
  • 22
  • 36
4
votes
1 answer

Update Jetpack Compose Slider Progress based on ExoPlayer playing audio position

I have created a custom UI for player an audio file and I am using Exoplayer to get the file and play it. I am not using the custom controller for exoplayer and my UI has a Slider that needs to update based on the current audio position. How can I…
SabetiG
  • 379
  • 2
  • 8
4
votes
1 answer

exoplayer - Enable subtitle on video

I want to add subtitle on video from srt (or vtt or ttml). What I have made till now - We have an api by which we get youtube video url with the subtitle file link on our own server. I extract video url from the youtube link with the help of a…
4
votes
2 answers

> Could not find com.google.android.exoplayer:exoplayer-core:r2.4.2

I am facing this exoplayer not found error in video android studio application after I updated my project dependencies. I don't know how to update old Exoplayer link to https://mvnrepository.com/artifact/com.google.android.exoplayer/exoplayer Can…
ayushkadbe
  • 91
  • 2
  • 13
4
votes
0 answers

Exoplayer - Supertypes of the following classes cannot be resolved

There are tons of questions with a similar title, I know. I've been through them all, tried all the proposed solutions but nothing helped. I have an Android library with a few Exoplayer dependencies. My library is published on JCenter for a couple…
Georgios
  • 4,764
  • 35
  • 48
4
votes
0 answers

Abstract Method Error with Android ExoPlayer

I am trying to make a stream play in an android project with Exoplayer. Unfortunately, I am facing this run time error. ERROR: 2020-11-17 17:04:27.867 8662-8765/com.example.videoplayer E/AndroidRuntime: FATAL EXCEPTION:…
Naroju
  • 2,637
  • 4
  • 25
  • 44
4
votes
2 answers

Exoplayer - Is it possible to check if a URL is a valid mp4/webm url before loading it?

Is it possible to check if it's actually a URL that can be loaded with the player before attempting to load it? String mUrl = " --- "; player = new SimpleExoPlayer.Builder(this).build(); playerView.setPlayer(player); …
DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83
4
votes
2 answers

For how long will Exoplayer play in the background?

I have used Exoplayer to play an audio stream. You can see the code below. I am not a professional Android dev, but I know that on android if you want something to run in the background you have to use services. I did not expect this player to play…
Dinu Nicolae
  • 1,019
  • 2
  • 17
  • 42
4
votes
2 answers

Exoplayer2.x: Player.STATE_ENDED fires twice when a video ends ,how to implement exoplayer in android?

I'm using Exoplayer to play a video in a playlist. I want to auto play the next video when the current video end. To do this, I added an EventListener to my player. Here's a snippet: private val videoPlayerListener = object: Player.EventListener { …
Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
4
votes
2 answers

ExoPlayer sometimes returns negative duration for an mp3 file from url

I'm making an app where I play .mp3 files from the URL. I'm using the latest version of ExoPlayer 2.11.4. What I need to do is get the total duration of the audio from the url so I can use it in my custom audio player. The urls I'm using are of this…
Jose Q
  • 441
  • 1
  • 4
  • 14
4
votes
2 answers

How to monitor playback position in exoplayer

I am struggling to find a way to create a thread to monitor the playbackPosition in Exoplayer app. In the following code, a simple task I need is to log the position parameter after every 1000ms by overriding the onIsPlayingChanged function. But I…
Nav89
  • 53
  • 1
  • 7