com.google.android.exoplayer2.source.UnrecognizedInputFormatException Java Examples
The following examples show how to use
com.google.android.exoplayer2.source.UnrecognizedInputFormatException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HlsPlaylistParser.java From MediaSDK with Apache License 2.0 | 5 votes |
@Override public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); Queue<String> extraLines = new ArrayDeque<>(); String line; try { if (!checkPlaylistHeader(reader)) { throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.", uri); } while ((line = reader.readLine()) != null) { line = line.trim(); if (line.isEmpty()) { // Do nothing. } else if (line.startsWith(TAG_STREAM_INF)) { extraLines.add(line); return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else if (line.startsWith(TAG_TARGET_DURATION) || line.startsWith(TAG_MEDIA_SEQUENCE) || line.startsWith(TAG_MEDIA_DURATION) || line.startsWith(TAG_KEY) || line.startsWith(TAG_BYTERANGE) || line.equals(TAG_DISCONTINUITY) || line.equals(TAG_DISCONTINUITY_SEQUENCE) || line.equals(TAG_ENDLIST)) { extraLines.add(line); return parseMediaPlaylist( masterPlaylist, new LineIterator(extraLines, reader), uri.toString()); } else { extraLines.add(line); } } } finally { Util.closeQuietly(reader); } throw new ParserException("Failed to parse the playlist, could not identify any tags."); }
Example #2
Source File: HlsPlaylistParser.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); Queue<String> extraLines = new ArrayDeque<>(); String line; try { if (!checkPlaylistHeader(reader)) { throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.", uri); } while ((line = reader.readLine()) != null) { line = line.trim(); if (line.isEmpty()) { // Do nothing. } else if (line.startsWith(TAG_STREAM_INF)) { extraLines.add(line); return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else if (line.startsWith(TAG_TARGET_DURATION) || line.startsWith(TAG_MEDIA_SEQUENCE) || line.startsWith(TAG_MEDIA_DURATION) || line.startsWith(TAG_KEY) || line.startsWith(TAG_BYTERANGE) || line.equals(TAG_DISCONTINUITY) || line.equals(TAG_DISCONTINUITY_SEQUENCE) || line.equals(TAG_ENDLIST)) { extraLines.add(line); return parseMediaPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else { extraLines.add(line); } } } finally { Util.closeQuietly(reader); } throw new ParserException("Failed to parse the playlist, could not identify any tags."); }
Example #3
Source File: HlsPlaylistParser.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); Queue<String> extraLines = new ArrayDeque<>(); String line; try { if (!checkPlaylistHeader(reader)) { throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.", uri); } while ((line = reader.readLine()) != null) { line = line.trim(); if (line.isEmpty()) { // Do nothing. } else if (line.startsWith(TAG_STREAM_INF)) { extraLines.add(line); return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else if (line.startsWith(TAG_TARGET_DURATION) || line.startsWith(TAG_MEDIA_SEQUENCE) || line.startsWith(TAG_MEDIA_DURATION) || line.startsWith(TAG_KEY) || line.startsWith(TAG_BYTERANGE) || line.equals(TAG_DISCONTINUITY) || line.equals(TAG_DISCONTINUITY_SEQUENCE) || line.equals(TAG_ENDLIST)) { extraLines.add(line); return parseMediaPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else { extraLines.add(line); } } } finally { Util.closeQuietly(reader); } throw new ParserException("Failed to parse the playlist, could not identify any tags."); }
Example #4
Source File: ProviderTvInputService.java From xipl with Apache License 2.0 | 5 votes |
@Override public void onPlayerError(ExoPlaybackException error) { if (error.getCause() instanceof BehindLiveWindowException) { Toast.makeText(mContext, R.string.stream_failure_retry, Toast.LENGTH_SHORT).show(); mProviderTvPlayer.restart(mContext); mProviderTvPlayer.play(); } else if (error.getCause() instanceof UnrecognizedInputFormatException) { // Channel cannot be played in case of an error in parsing the ".m3u8" file. Toast.makeText(mContext, mContext.getString(R.string.channel_stream_failure), Toast.LENGTH_SHORT).show(); } else if (error.getCause() instanceof HttpDataSource.InvalidResponseCodeException) { /* We might get errors different like 403 which indicate permission denied due to multiple connections at the same time or 502 meaning bad gateway. Restart the loading after 5 seconds. */ Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { if (mContext != null && mProviderTvPlayer != null) { Toast.makeText(mContext, R.string.stream_failure_retry, Toast.LENGTH_SHORT).show(); mProviderTvPlayer.restart(mContext); mProviderTvPlayer.play(); } } }, 5000); } else if (error.getCause() instanceof HttpDataSource.HttpDataSourceException) { // Timeout, nothing we can do really... Toast.makeText(mContext, R.string.channel_stream_failure, Toast.LENGTH_SHORT).show(); } }
Example #5
Source File: HlsPlaylistParser.java From K-Sonic with MIT License | 5 votes |
@Override public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); Queue<String> extraLines = new LinkedList<>(); String line; try { if (!checkPlaylistHeader(reader)) { throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.", uri); } while ((line = reader.readLine()) != null) { line = line.trim(); if (line.isEmpty()) { // Do nothing. } else if (line.startsWith(TAG_STREAM_INF)) { extraLines.add(line); return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else if (line.startsWith(TAG_TARGET_DURATION) || line.startsWith(TAG_MEDIA_SEQUENCE) || line.startsWith(TAG_MEDIA_DURATION) || line.startsWith(TAG_KEY) || line.startsWith(TAG_BYTERANGE) || line.equals(TAG_DISCONTINUITY) || line.equals(TAG_DISCONTINUITY_SEQUENCE) || line.equals(TAG_ENDLIST)) { extraLines.add(line); return parseMediaPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else { extraLines.add(line); } } } finally { Util.closeQuietly(reader); } throw new ParserException("Failed to parse the playlist, could not identify any tags."); }
Example #6
Source File: HlsPlaylistParser.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); Queue<String> extraLines = new ArrayDeque<>(); String line; try { if (!checkPlaylistHeader(reader)) { throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.", uri); } while ((line = reader.readLine()) != null) { line = line.trim(); if (line.isEmpty()) { // Do nothing. } else if (line.startsWith(TAG_STREAM_INF)) { extraLines.add(line); return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else if (line.startsWith(TAG_TARGET_DURATION) || line.startsWith(TAG_MEDIA_SEQUENCE) || line.startsWith(TAG_MEDIA_DURATION) || line.startsWith(TAG_KEY) || line.startsWith(TAG_BYTERANGE) || line.equals(TAG_DISCONTINUITY) || line.equals(TAG_DISCONTINUITY_SEQUENCE) || line.equals(TAG_ENDLIST)) { extraLines.add(line); return parseMediaPlaylist( masterPlaylist, new LineIterator(extraLines, reader), uri.toString()); } else { extraLines.add(line); } } } finally { Util.closeQuietly(reader); } throw new ParserException("Failed to parse the playlist, could not identify any tags."); }
Example #7
Source File: HlsPlaylistParser.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public HlsPlaylist parse(Uri uri, InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); Queue<String> extraLines = new ArrayDeque<>(); String line; try { if (!checkPlaylistHeader(reader)) { throw new UnrecognizedInputFormatException("Input does not start with the #EXTM3U header.", uri); } while ((line = reader.readLine()) != null) { line = line.trim(); if (line.isEmpty()) { // Do nothing. } else if (line.startsWith(TAG_STREAM_INF)) { extraLines.add(line); return parseMasterPlaylist(new LineIterator(extraLines, reader), uri.toString()); } else if (line.startsWith(TAG_TARGET_DURATION) || line.startsWith(TAG_MEDIA_SEQUENCE) || line.startsWith(TAG_MEDIA_DURATION) || line.startsWith(TAG_KEY) || line.startsWith(TAG_BYTERANGE) || line.equals(TAG_DISCONTINUITY) || line.equals(TAG_DISCONTINUITY_SEQUENCE) || line.equals(TAG_ENDLIST)) { extraLines.add(line); return parseMediaPlaylist( masterPlaylist, new LineIterator(extraLines, reader), uri.toString()); } else { extraLines.add(line); } } } finally { Util.closeQuietly(reader); } throw new ParserException("Failed to parse the playlist, could not identify any tags."); }