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