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