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
2
votes
2 answers

Create a simple exoplayer to stream video from url

I am a complete beginner at android studio. and I am working on a simple application in which I have to stream a video from a URL. Just a simple Exoplayer I tried the below code but it doesn't work. If anybody knows please…
2
votes
1 answer

In exoplayer, how to play buffered bytes from inputstram as a video?

I am downloading an mp4 video into a local disk drive from an intranet as the following: while ((bufferLength = inputstram.read(buffer)) > 0) { fileOutputStream.write(buffer, 0, bufferLength); //play(buffer); …
Khaled
  • 345
  • 5
  • 14
2
votes
1 answer

Exoplayer should play video with lowest video quality

I would like to play my video at the lowest resolution(256x144). I have configured the DefaultTrackSelector by setting two parameters: 1.setMaxVideoSize(width, height) to limit the resolution to your…
Tushar Lathiya
  • 940
  • 9
  • 26
2
votes
3 answers

ExoPlayer not loading subtitles from .srt file

So I am trying to show subtitles from my .srt file in exoplayer but it does not work. Do I need to use a seperate SubtitleView to get my subtitles to show up? Is the subtitleView in the PlayerView is not enough? I use PlayerView btw. The exoplayer…
Rag
  • 101
  • 1
  • 11
2
votes
1 answer

What are the differences between VideoView and ExoPlayer. Why would I prefer one over the other?

I develop a video streaming app and I'm researching existing video rendering libraries to render .mkv (H253-255) and .mp4. I saw there is a native Android View called VideoView that uses MediaCodec and has a lot of functionalities so I was sure this…
2
votes
1 answer

Exoplayer in recycler view keeps playing when app goes in background

Here is the implementation of my exoplayer inside recycler view. I want the the exoplayer to stop when app goes in background. protected void onBindViewHolder(@NonNull AudioModelHolder holder, int position, @NonNull AudioModel model) { …
Puneet
  • 21
  • 1
2
votes
2 answers

can't resolve @layout/exo_simple_player_view

I had implemented Exoplayer in my project and it was working perfectly but today it started producing error in my XML layout for the field app:player_layout_id="@layout/exo_simple_player_view", saying that can't resolve…
Mona Baharlou
  • 1,401
  • 1
  • 13
  • 26
2
votes
2 answers

Exoplayer in recyclerview with images and video like instagram but stop only last video other still playing after backpressed in android

I tried all StackOverflow answers and youtube solutions but cannot found anything suitable that's why I post my question in it. I want to make an app like Instagram which I show images and video but the issue is when I swipe up in recycler view all…
Adnan haider
  • 553
  • 8
  • 21
2
votes
0 answers

Can I control speed and quality of youtube video in exoplayer android?

I am working with Exoplayer to play youtube videos on android. But unable to control the speed and quality of the video. Is it possible to do that.
Bhaskar Jyoti Dutta
  • 1,740
  • 2
  • 15
  • 30
2
votes
1 answer

Unable to resume playback in exoplayer when app minimized and resumed

In my simple exoPlayer i play video file and when app is minimized and maximized i was not able to resume the play back here is my code. private void initializePlayer() { if (player == null) { DefaultTrackSelector trackSelector =…
sanoj lawrence
  • 951
  • 5
  • 29
  • 69
2
votes
0 answers

Android ExoPlayer crashes on unstable network

In our project we use Android exoPLayer version 2. But when we trying to play the live hls with unstable network connection(a lot of tcp drops) the player crashes with OOM. Before OOM player works with freezes. Throwing OutOfMemoryError "Failed to…
Roman Kazmin
  • 931
  • 6
  • 18
2
votes
1 answer

DummyDataSource cannot be opened : Android ExoPlayer

I am trying to stream videos from URLs and save them in cache during the same time. I am using the DataBaseInspector of Android Studio to check the cache and it seems to work but not all the time. Sometimes i have this error when i try to play a…
Tom3652
  • 2,540
  • 3
  • 19
  • 45
2
votes
2 answers

better_player or exoplayer throwing exception OMX.MTK.VIDEO.DECODER.AVC

I am having an issue on the better_player, where some devices aren't streaming a live link because of this exception: Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed:…
Lutaaya Huzaifah Idris
  • 3,596
  • 8
  • 38
  • 77
2
votes
1 answer

Android ExoPlayer How Listen to Video Duration and Do Something on Each Second We Want?

I am streaming video from server with ExoPlayer, I want to show dialogs in specific seconds of video, so I want to listen to ExoPlayer duration and get which second is current second of playing and if it is the time that I want than stop the player…
Mohad Hadi
  • 1,826
  • 3
  • 24
  • 39
2
votes
1 answer

Why is my Exoplayer2 CacheDataSource not writing the downloaded stream to the designated cache?

I have implemented a custom cache for Exoplayer2 - and am migrating from 2.11.x to 2.12.3. I have reviewed several posts here on SO (ex: here), as well as various parts from the latest Exoplayer2 developer docs (ex: here). I can get the video…
tfrysinger
  • 1,306
  • 11
  • 26