1---
2title: Troubleshooting
3redirect_from:
4  - /faqs.html
5  - /debugging-playback-issues.html
6---
7
8* [Fixing "Cleartext HTTP traffic not permitted" errors][]
9* [Fixing "SSLHandshakeException" and "CertPathValidatorException" errors][]
10* [Why are some media files not seekable?][]
11* [Why is seeking inaccurate in some MP3 files?][]
12* [Why do some MPEG-TS files fail to play?][]
13* [Why do some MP4/FMP4 files play incorrectly?][]
14* [Why do some streams fail with HTTP response code 301 or 302?][]
15* [Why do some streams fail with UnrecognizedInputFormatException?][]
16* [Why doesn't setPlaybackParameters work properly on some devices?][]
17* [What do "Player is accessed on the wrong thread" errors mean?][]
18* [How can I fix "Unexpected status line: ICY 200 OK"?][]
19* [How can I query whether the stream being played is a live stream?][]
20* [How do I keep audio playing when my app is backgrounded?][]
21* [Why does ExoPlayer support my content but the Cast extension doesn't?][]
22* [Why does content fail to play, but no error is surfaced?]
23* [How can I get a decoding extension to load and be used for playback?][]
24* [Can I play YouTube videos directly with ExoPlayer?][]
25
26---
27
28#### Fixing "Cleartext HTTP traffic not permitted" errors ####
29
30This error will occur if your app requests cleartext HTTP traffic (i.e.,
31`http://` rather than `https://`) when its Network Security Configuration does
32not permit it. If your app targets Android 9 (API level 28) or later, cleartext
33HTTP traffic is disabled by the default configuration.
34
35If your app needs to work with cleartext HTTP traffic then you need to use a
36Network Security Configuration that permits it. Please see Android's
37[network security documentation](https://developer.android.com/training/articles/security-config.html)
38for details. To enable all cleartext HTTP traffic, you can simply add
39`android:usesCleartextTraffic="true"` to the `application` element of your app's
40`AndroidManifest.xml`.
41
42The ExoPlayer demo app uses the default Network Security Configuration, and so
43does not allow cleartext HTTP traffic. You can enable it using the instructions
44above.
45
46#### Fixing "SSLHandshakeException" and "CertPathValidatorException" errors ####
47
48`SSLHandshakeException` and `CertPathValidatorException` both indicate a problem
49with the server's SSL certificate. These errors are not ExoPlayer specific.
50Please see
51[Android's SSL documentation](https://developer.android.com/training/articles/security-ssl#CommonProblems)
52for more details.
53
54#### Why are some media files not seekable? ####
55
56By default ExoPlayer does not support seeking in media where the only method for
57performing accurate seek operations is for the player to scan and index the
58entire file. ExoPlayer considers such files as unseekable. Most modern media
59container formats include metadata for seeking (e.g., a sample index), have a
60well defined seek algorithm (e.g., interpolated bisection search for Ogg), or
61indicate that their content is constant bitrate. Efficient seek operations are
62possible and supported by ExoPlayer in these cases.
63
64If you require seeking but have unseekable media, we suggest converting your
65content to use a more appropriate container format. For MP3, ADTS and AMR files,
66you can also enable seeking under the assumption that the files have a constant
67bitrate, as described
68[here](customization.html#enabling-constant-bitrate-seeking).
69
70#### Why is seeking inaccurate in some MP3 files? ####
71
72Variable bitrate (VBR) MP3 files are fundamentally unsuitable for use cases that
73require exact seeking. There are two reasons for this:
74
751. For exact seeking, a container format will ideally provide a precise
76   time-to-byte mapping in a header. This mapping allows a player to map a
77   requested seek time to the corresponding byte offset, and start requesting,
78   parsing and playing media from that offset. The headers available for
79   specifying this mapping in MP3 (e.g., XING headers) are, unfortunately, often
80   imprecise.
811. For container formats that don't provide a precise time-to-byte mapping (or
82   any time-to-byte mapping at all), it's still possible to perform an exact
83   seek if the container includes absolute sample timestamps in the stream. In
84   this case a player can map the seek time to a best guess of the corresponding
85   byte offset, start requesting media from that offset, parse the first
86   absolute sample timestamp, and effectively perform a guided binary search
87   into the media until it finds the right sample. Unfortunately MP3 does not
88   include absolute sample timestamps in the stream, so this approach is not
89   possible.
90
91For these reasons, the only way to perform an exact seek into a VBR MP3 file is
92to scan the entire file and manually build up a time-to-byte mapping in the
93player. This strategy can be enabled by using [`FLAG_ENABLE_INDEX_SEEKING`][],
94which can be [set on a `DefaultExtractorsFactory`][] using
95[`setMp3ExtractorFlags`][]. Note that it doesn't scale well to large MP3 files,
96particularly if the user tries to seek to near the end of the stream shortly
97after starting playback, which requires the player to wait until it's downloaded
98and indexed the entire stream before performing the seek. In ExoPlayer, we
99decided to optimize for speed over accuracy in this case and
100[`FLAG_ENABLE_INDEX_SEEKING`][] is therefore disabled by default.
101
102If you control the media you're playing, we strongly advise that you use a more
103appropriate container format, such as MP4. There are no use cases we're aware of
104where MP3 is the best choice of media format.
105
106#### Why do some MPEG-TS files fail to play? ####
107
108Some MPEG-TS files do not contain access unit delimiters (AUDs). By default
109ExoPlayer relies on AUDs to cheaply detect frame boundaries. Similarly, some
110MPEG-TS files do not contain IDR keyframes. By default these are the only type
111of keyframes considered by ExoPlayer.
112
113ExoPlayer will appear to be stuck in the buffering state when asked to play an
114MPEG-TS file that lacks AUDs or IDR keyframes. If you need to play such files,
115you can do so using [`FLAG_DETECT_ACCESS_UNITS`][] and
116[`FLAG_ALLOW_NON_IDR_KEYFRAMES`][] respectively. These flags can be [set on a
117`DefaultExtractorsFactory`][] using [`setTsExtractorFlags`][] or on a
118`DefaultHlsExtractorFactory` using the
119[constructor]({{ site.exo_sdk }}/source/hls/DefaultHlsExtractorFactory.html#DefaultHlsExtractorFactory-int-boolean-).
120Use of `FLAG_DETECT_ACCESS_UNITS` has no side effects other than being
121computationally expensive relative to AUD based frame boundary detection. Use of
122`FLAG_ALLOW_NON_IDR_KEYFRAMES` may result in temporary visual corruption at the
123start of playback and immediately after seeks when playing some MPEG-TS files.
124
125#### Why do some MP4/FMP4 files play incorrectly? ####
126
127Some MP4/FMP4 files contain edit lists that rewrite the media timeline by
128skipping, moving or repeating lists of samples. ExoPlayer has partial support
129for applying edit lists. For example, it can delay or repeat groups of samples
130starting on a synchronization sample, but it does not truncate audio samples or
131preroll media for edits that don't start on a synchronization sample.
132
133If you are seeing that part of the media is unexpectedly missing or repeated,
134try setting [`Mp4Extractor.FLAG_WORKAROUND_IGNORE_EDIT_LISTS`][] or
135[`FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_EDIT_LISTS`][], which will cause
136the extractor to ignore edit lists entirely. These can be [set on a
137`DefaultExtractorsFactory`][] using [`setMp4ExtractorFlags`][] or
138[`setFragmentedMp4ExtractorFlags`][].
139
140#### Why do some streams fail with HTTP response code 301 or 302? ####
141
142HTTP response codes 301 and 302 both indicate redirection. Brief descriptions
143can be found on [Wikipedia][]. When ExoPlayer makes a request and receives a
144response with status code 301 or 302, it will normally follow the redirect
145and start playback as normal. The one case where this does not happen by default
146is for cross-protocol redirects. A cross-protocol redirect is one that redirects
147from HTTPS to HTTP or vice-versa (or less commonly, between another pair of
148protocols). You can test whether a URL causes a cross-protocol redirect using
149the [wget][] command line tool as follows:
150```
151wget "https://yourserver.com/test.mp3" 2>&1  | grep Location
152```
153The output should look something like this:
154```
155$ wget "https://yourserver.com/test.mp3" 2>&1  | grep Location
156Location: https://second.com/test.mp3 [following]
157Location: http://third.com/test.mp3 [following]
158```
159In this example there are two redirects. The first redirect is from
160`https://yourserver.com/test.mp3` to `https://second.com/test.mp3`. Both are
161HTTPS, and so this is not a cross-protocol redirect. The second redirect is from
162`https://second.com/test.mp3` to `http://third.com/test.mp3`. This redirects
163from HTTPS to HTTP and so is a cross-protocol redirect. ExoPlayer will not
164follow this redirect in its default configuration, meaning playback will fail.
165
166If you need to, you can configure ExoPlayer to follow cross-protocol redirects
167when instantiating `DefaultHttpDataSourceFactory` instances used in your
168application. Learn about selecting and configuring the network stack
169[here]({{ site.base_url }}/customization.html#configuring-the-network-stack).
170
171#### Why do some streams fail with UnrecognizedInputFormatException? ####
172
173This question relates to playback failures of the form:
174```
175UnrecognizedInputFormatException: None of the available extractors
176(MatroskaExtractor, FragmentedMp4Extractor, ...) could read the stream.
177```
178There are two possible causes of this failure. The most common cause is that
179you're trying to play DASH (mpd), HLS (m3u8) or SmoothStreaming (ism, isml)
180content, but the player tries to play it as a progressive stream. To play such
181streams, you must depend on the respective [ExoPlayer module][]. In cases where
182the stream URI doesn't end with the standard file extension, you can also pass
183`MimeTypes.APPLICATION_MPD`, `MimeTypes.APPLICATION_M3U8` or
184`MimeTypes.APPLICATION_SS` to `setMimeType` of `MediaItem.Builder` to explicitly
185specify the type of stream.
186
187The second, less common cause, is that ExoPlayer does not support the container
188format of the media that you're trying to play. In this case the failure is
189working as intended, however feel free to submit a feature request to our
190[issue tracker][], including details of the container format and a test stream.
191Please search for an existing feature request before submitting a new one.
192
193#### Why doesn't setPlaybackParameters work properly on some devices? ####
194
195When running a debug build of your app on Android M and earlier, you may
196experience choppy performance, audible artifacts and high CPU utilization when
197using the [`setPlaybackParameters`][] API. This is because an optimization
198that's important to this API is disabled for debug builds running on these
199versions of Android.
200
201It's important to note that this issue affects debug builds only. It does *not*
202affect release builds, for which the optimization is always enabled. Hence the
203releases you provide to end users should not be affected by this issue.
204
205#### What do "Player is accessed on the wrong thread" errors mean? ####
206
207See [A note on threading][] on the getting started page.
208
209#### How can I fix "Unexpected status line: ICY 200 OK"? ####
210
211This problem can occur if the server response includes an ICY status line,
212rather than one that's HTTP compliant. ICY status lines are deprecated and
213should not be used, so if you control the server you should update it to provide
214an HTTP compliant response. If you're unable to do this then using the
215[OkHttp extension][] will resolve the problem, since it's able to handle ICY
216status lines correctly.
217
218#### How can I query whether the stream being played is a live stream? ####
219
220You can query the player's [`isCurrentWindowLive`][] method. In addition, you
221can check [`isCurrentWindowDynamic`][] to find out whether the window is dynamic
222(i.e., still updating over time).
223
224#### How do I keep audio playing when my app is backgrounded? ####
225
226There are a few steps that you need to take to ensure continued playback of
227audio when your app is in the background:
228
2291. You need to have a running [foreground service][]. This prevents the system
230   from killing your process to free up resources.
2311. You need to hold a [`WifiLock`][] and a [`WakeLock`][]. These ensure that the
232   system keeps the WiFi radio and CPU awake. This can be easily done if using
233   [`ExoPlayer`][] by calling [`setWakeMode`][], which will automatically
234   acquire and release the required locks at the correct times.
235
236It's important that you release the locks (if not using `setWakeMode`) and stop
237the service as soon as audio is no longer being played.
238
239#### Why does ExoPlayer support my content but the Cast extension doesn't? ####
240
241It's possible that the content that you are trying to play is not
242[CORS enabled][]. The [Cast framework][] requires content to be CORS enabled in
243order to play it.
244
245#### Why does content fail to play, but no error is surfaced? ####
246
247It's possible that the device on which you are playing the content does not
248support a specific media sample format. This can be easily confirmed by adding
249an [`EventLogger`][] as a listener to your player, and looking for a line
250similar to this one in Logcat:
251```
252[ ] Track:x, id=x, mimeType=mime/type, ... , supported=NO_UNSUPPORTED_TYPE
253```
254`NO_UNSUPPORTED_TYPE` means that the device is not able to decode the media
255sample format specified by the `mimeType`. See the [Android media formats
256documentation][] for information about supported sample formats. [How can I get
257a decoding extension to load and be used for playback?] may also be useful.
258
259#### How can I get a decoding extension to load and be used for playback? ####
260
261* Most extensions have manual steps to check out and build the dependencies, so
262  make sure you've followed the steps in the README for the relevant extension.
263  For example, for the FFmpeg extension it's necessary to follow the
264  instructions in [extensions/ffmpeg/README.md][], including passing
265  configuration flags to [enable decoders][] for the format(s) you want to play.
266* For extensions that have native code, make sure you're using the correct
267  version of the Android NDK as specified in the README, and look out for any
268  errors that appear during configuration and building. You should see `.so`
269  files appear in the `libs` subdirectory of the extension's path for each
270  supported architecture after following the steps in the README.
271* To try out playback using the extension in the [demo application][], see
272  [enabling extension decoders][]. See the README for the extension for
273  instructions on using the extension from your own app.
274* If you're using [`DefaultRenderersFactory`][], you should see an info-level
275  log line like "Loaded FfmpegAudioRenderer" in Logcat when the extension loads.
276  If that's missing, make sure the application has a dependency on the
277  extension.
278* If you see warning-level logs from [`LibraryLoader`][] in Logcat, this
279  indicates that loading the native component of the extension failed. If this
280  happens, check you've followed the steps in the extension's README correctly
281  and that no errors were output while following the instructions.
282
283If you're still experiencing problems using extensions, please check the
284ExoPlayer [issue tracker][] for any relevant recent issues. If you need to file
285a new issue and it relates to building the native part of the extension, please
286include full command line output from running README instructions, to help us
287diagnose the issue.
288
289#### Can I play YouTube videos directly with ExoPlayer? ####
290
291No, ExoPlayer cannot play videos from YouTube, i.e., urls of the form
292`https://www.youtube.com/watch?v=...`. Instead, you should use the [YouTube
293Android Player API](https://developers.google.com/youtube/android/player/) which
294is the official way to play YouTube videos on Android.
295
296[Fixing "Cleartext HTTP traffic not permitted" errors]: #fixing-cleartext-http-traffic-not-permitted-errors
297[Fixing "SSLHandshakeException" and "CertPathValidatorException" errors]: #fixing-sslhandshakeexception-and-certpathvalidatorexception-errors
298[What formats does ExoPlayer support?]: #what-formats-does-exoplayer-support
299[Why are some media files not seekable?]: #why-are-some-media-files-not-seekable
300[Why is seeking inaccurate in some MP3 files?]: #why-is-seeking-inaccurate-in-some-mp3-files
301[Why do some MPEG-TS files fail to play?]: #why-do-some-mpeg-ts-files-fail-to-play
302[Why do some MP4/FMP4 files play incorrectly?]: #why-do-some-mp4fmp4-files-play-incorrectly
303[Why do some streams fail with HTTP response code 301 or 302?]: #why-do-some-streams-fail-with-http-response-code-301-or-302
304[Why do some streams fail with UnrecognizedInputFormatException?]: #why-do-some-streams-fail-with-unrecognizedinputformatexception
305[Why doesn't setPlaybackParameters work properly on some devices?]: #why-doesnt-setplaybackparameters-work-properly-on-some-devices
306[What do "Player is accessed on the wrong thread" errors mean?]: #what-do-player-is-accessed-on-the-wrong-thread-errors-mean
307[How can I fix "Unexpected status line: ICY 200 OK"?]:  #how-can-i-fix-unexpected-status-line-icy-200-ok
308[How can I query whether the stream being played is a live stream?]: #how-can-i-query-whether-the-stream-being-played-is-a-live-stream
309[How do I keep audio playing when my app is backgrounded?]: #how-do-i-keep-audio-playing-when-my-app-is-backgrounded
310[Why does ExoPlayer support my content but the Cast extension doesn't?]: #why-does-exoplayer-support-my-content-but-the-cast-extension-doesnt
311[Why does content fail to play, but no error is surfaced?]: #why-does-content-fail-to-play-but-no-error-is-surfaced
312[How can I get a decoding extension to load and be used for playback?]: #how-can-i-get-a-decoding-extension-to-load-and-be-used-for-playback
313[Can I play YouTube videos directly with ExoPlayer?]: #can-i-play-youtube-videos-directly-with-exoplayer
314
315
316[Supported formats]: {{ site.baseurl }}/supported-formats.html
317[set on a `DefaultExtractorsFactory`]: {{ site.base_url }}/customization.html#customizing-extractor-flags
318[`setMp3ExtractorFlags`]: {{ site.exo_sdk }}/extractor/DefaultExtractorsFactory#setMp3ExtractorFlags(int)
319[`FLAG_ENABLE_INDEX_SEEKING`]: {{ site.exo_sdk }}/extractor/mp3/Mp3Extractor.html#FLAG_ENABLE_INDEX_SEEKING
320[`FLAG_DETECT_ACCESS_UNITS`]: {{ site.exo_sdk }}/extractor/ts/DefaultTsPayloadReaderFactory.html#FLAG_DETECT_ACCESS_UNITS
321[`FLAG_ALLOW_NON_IDR_KEYFRAMES`]: {{ site.exo_sdk }}/extractor/ts/DefaultTsPayloadReaderFactory.html#FLAG_ALLOW_NON_IDR_KEYFRAMES
322[`setTsExtractorFlags`]: {{ site.exo_sdk }}/extractor/DefaultExtractorsFactory#setTsExtractorFlags(int)
323[`Mp4Extractor.FLAG_WORKAROUND_IGNORE_EDIT_LISTS`]: {{ site.exo_sdk }}/extractor/mp4/Mp4Extractor.html#FLAG_WORKAROUND_IGNORE_EDIT_LISTS
324[`FragmentedMp4Extractor.FLAG_WORKAROUND_IGNORE_EDIT_LISTS`]: {{ site.exo_sdk }}/extractor/mp4/FragmentedMp4Extractor.html#FLAG_WORKAROUND_IGNORE_EDIT_LISTS
325[`setMp4ExtractorFlags`]: {{ site.exo_sdk }}/extractor/DefaultExtractorsFactory#setMp4ExtractorFlags(int)
326[`setFragmentedMp4ExtractorFlags`]: {{ site.exo_sdk }}/extractor/DefaultExtractorsFactory#setFragmentedMp4ExtractorFlags(int)
327[Wikipedia]: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
328[wget]: https://www.gnu.org/software/wget/manual/wget.html
329[`DefaultHttpDataSourceFactory`]: {{ site.exo_sdk }}/upstream/DefaultHttpDataSourceFactory.html
330[ExoPlayer module]: {{ site.base_url }}/hello-world.html#add-exoplayer-modules
331[issue tracker]: https://github.com/google/ExoPlayer/issues
332[`isCurrentWindowLive`]: {{ site.exo_sdk }}/Player.html#isCurrentWindowLive()
333[`isCurrentWindowDynamic`]: {{ site.exo_sdk }}/Player.html#isCurrentWindowDynamic()
334[`setPlaybackParameters`]: {{ site.exo_sdk }}/Player.html#setPlaybackParameters(com.google.android.exoplayer2.PlaybackParameters)
335[foreground service]: https://developer.android.com/guide/components/services.html#Foreground
336[`WifiLock`]: {{ site.android_sdk }}/android/net/wifi/WifiManager.WifiLock.html
337[`WakeLock`]: {{ site.android_sdk }}/android/os/PowerManager.WakeLock.html
338[`ExoPlayer`]: {{ site.exo_sdk }}/ExoPlayer.html
339[`setWakeMode`]: {{ site.exo_sdk }}/ExoPlayer.html#setWakeMode(int)
340[A note on threading]: {{ site.base_url }}/hello-world.html#a-note-on-threading
341[OkHttp extension]: {{ site.release_v2 }}/extensions/okhttp
342[CORS enabled]: https://www.w3.org/wiki/CORS_Enabled
343[Cast framework]: {{ site.google_sdk }}/cast/docs/chrome_sender/advanced#cors_requirements
344[Android media formats documentation]: https://developer.android.com/guide/topics/media/media-formats#core
345[extensions/ffmpeg/README.md]: {{ site.release_v2 }}/extensions/ffmpeg/README.md
346[enable decoders]: {{ site.base_url }}/supported-formats.html#ffmpeg-extension
347[demo application]: {{ site.base_url }}/demo-application.html
348[enabling extension decoders]: {{ site.base_url }}/demo-application.html#enabling-extension-decoders
349[`DefaultRenderersFactory`]: {{ site.exo_sdk }}/DefaultRenderersFactory.html
350[`LibraryLoader`]: {{ site.exo_sdk }}/util/LibraryLoader.html
351[`EventLogger`]: {{ site.baseurl }}/debug-logging.html
352