Disable ExoPlayer id3 extraction
Malformed audio files can cause a crash in ExoPlayer. We have our own id3 extractor and don't use the data of ExoPlayer, so we can just disable parsing in ExoPlayer. This reduces the number locations where something can go wrong that prevents playback.
This commit is contained in:
parent
65bf8bf70c
commit
93b2a07811
|
@ -16,6 +16,7 @@ import com.google.android.exoplayer2.SeekParameters;
|
||||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||||
import com.google.android.exoplayer2.audio.AudioAttributes;
|
import com.google.android.exoplayer2.audio.AudioAttributes;
|
||||||
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
|
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
|
||||||
|
import com.google.android.exoplayer2.extractor.mp3.Mp3Extractor;
|
||||||
import com.google.android.exoplayer2.source.MediaSource;
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
||||||
import com.google.android.exoplayer2.source.TrackGroupArray;
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||||
|
@ -210,6 +211,7 @@ public class ExoPlayerWrapper implements IPlayer {
|
||||||
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, null, httpDataSourceFactory);
|
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context, null, httpDataSourceFactory);
|
||||||
DefaultExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
|
DefaultExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
|
||||||
extractorsFactory.setConstantBitrateSeekingEnabled(true);
|
extractorsFactory.setConstantBitrateSeekingEnabled(true);
|
||||||
|
extractorsFactory.setMp3ExtractorFlags(Mp3Extractor.FLAG_DISABLE_ID3_METADATA);
|
||||||
ProgressiveMediaSource.Factory f = new ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory);
|
ProgressiveMediaSource.Factory f = new ProgressiveMediaSource.Factory(dataSourceFactory, extractorsFactory);
|
||||||
mediaSource = f.createMediaSource(Uri.parse(s));
|
mediaSource = f.createMediaSource(Uri.parse(s));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue