com.google.android.exoplayer.ExoPlaybackException Java Examples
The following examples show how to use
com.google.android.exoplayer.ExoPlaybackException.
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: Eia608TrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
@Override protected int doPrepare() throws ExoPlaybackException { try { boolean sourcePrepared = source.prepare(); if (!sourcePrepared) { return TrackRenderer.STATE_UNPREPARED; } } catch (IOException e) { throw new ExoPlaybackException(e); } for (int i = 0; i < source.getTrackCount(); i++) { if (eia608Parser.canParse(source.getTrackInfo(i).mimeType)) { trackIndex = i; return TrackRenderer.STATE_PREPARED; } } return TrackRenderer.STATE_IGNORE; }
Example #2
Source File: VLCVideoTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
@Override protected void onStarted() throws ExoPlaybackException { System.out.println(">>>VLCVideoTrackRenderer.onStarted()"); VLCVideoSurfaceHandler.Start_Type t = this.surfaceHdl.doStart(new Runnable() { @Override public void run() { try { VLCVideoTrackRenderer.this.p_onStarted(); } catch (ExoPlaybackException e) { e.printStackTrace(); postError(new com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException( null, e, -1)); } } }); System.out.println(">>> VLCVideoTrackRenderer.onStarted() t = " + t); if (t == Start_Type.STARTED_IMMEDIATELY) super.onStarted(); }
Example #3
Source File: VLCVideoSurfaceHandler.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
public VLCVideoSurfaceHandler( LibVLC libvlc, Handler eventHandler, MediaCodecVideoTrackRenderer.EventListener eventListener, SurfaceLayoutHandler layoutHandler) throws ExoPlaybackException { super(); this.libvlc = libvlc; this.eventHandler = eventHandler; this.eventListener = eventListener; if (layoutHandler != null) { this.layoutHandler = layoutHandler; SurfaceHolder surfaceHolder = layoutHandler.getHolder(); ExoVlcUtil.log(this, "VLCIVideoSurfaceHandler.VLCIVideoSurfaceHandler()"); ExoVlcUtil.log(this, "## ====> rect= " + surfaceHolder.getSurfaceFrame()); if (com.exovlc.ExoVlcUtil.validSurface(surfaceHolder)) setVlcSurface(surfaceHolder.getSurface(), false); } else throw new ExoPlaybackException("layout handler null."); }
Example #4
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
@Override protected void onStarted() throws ExoPlaybackException { super.onStarted(); System.out.println(">>>>>>>> VLCTrackRenderer.onStarted(" + getClass().getSimpleName() + ") "); Thread.dumpStack(); String uri = source.getUri(); if (!vlc.isPlaying()) try { System.out.println(">>>>>>>> VLCTrackRenderer.onStarted( ) uri = " + uri + " vdo =" + vlc.hasVideoTrack(uri)); String[] options = vlc.getMediaOptions(!true, !vlc.hasVideoTrack(uri)); System.out.println(">>VLCTrackRenderer.onStarted() OPTIONS:"); for (int i = 0; i < options.length; i++) System.out.println(" o-" + i + ":" + options[i]); vlc.playMRL(uri, options); System.out.println(">>> VLCTrackRenderer.onStarted() playMRL done"); } catch (IOException e) { e.printStackTrace(); throw new ExoPlaybackException(e); } }
Example #5
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
@Override protected void onStarted() throws ExoPlaybackException { super.onStarted(); System.out.println(">>>>>>>> VLCTrackRenderer.onStarted(" + getClass().getSimpleName() + ") "); Thread.dumpStack(); String uri = source.getUri(); if (!vlc.isPlaying()) try { System.out.println(">>>>>>>> VLCTrackRenderer.onStarted( ) uri = " + uri + " vdo =" + vlc.hasVideoTrack(uri)); String[] options = vlc.getMediaOptions(!true, !vlc.hasVideoTrack(uri)); System.out.println(">>VLCTrackRenderer.onStarted() OPTIONS:"); for (int i = 0; i < options.length; i++) System.out.println(" o-" + i + ":" + options[i]); vlc.playMRL(uri, options); System.out.println(">>> VLCTrackRenderer.onStarted() playMRL done"); } catch (IOException e) { e.printStackTrace(); throw new ExoPlaybackException(e); } }
Example #6
Source File: TextTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
@Override protected int doPrepare() throws ExoPlaybackException { try { boolean sourcePrepared = source.prepare(); if (!sourcePrepared) { return TrackRenderer.STATE_UNPREPARED; } } catch (IOException e) { throw new ExoPlaybackException(e); } for (int i = 0; i < subtitleParsers.length; i++) { for (int j = 0; j < source.getTrackCount(); j++) { if (subtitleParsers[i].canParse(source.getTrackInfo(j).mimeType)) { parserIndex = i; trackIndex = j; return TrackRenderer.STATE_PREPARED; } } } return TrackRenderer.STATE_IGNORE; }
Example #7
Source File: MetadataTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
@Override protected int doPrepare() throws ExoPlaybackException { try { boolean sourcePrepared = source.prepare(); if (!sourcePrepared) { return TrackRenderer.STATE_UNPREPARED; } } catch (IOException e) { throw new ExoPlaybackException(e); } for (int i = 0; i < source.getTrackCount(); i++) { if (metadataParser.canParse(source.getTrackInfo(i).mimeType)) { trackIndex = i; return TrackRenderer.STATE_PREPARED; } } return TrackRenderer.STATE_IGNORE; }
Example #8
Source File: VLCSampleExtractor.java From Exoplayer_VLC with Apache License 2.0 | 6 votes |
public VLCSampleExtractor(LibVLC vlc, String uri) throws ExoPlaybackException { if (vlc == null || uri == null) throw new ExoPlaybackException("null parms!"); this.uri = uri; this.lib = vlc; this.media = ExoVlcUtil.getMedia(vlc, uri); this.vlctracks = ExoVlcUtil.getAvailableTracks(media); if (this.vlctracks.length > 0) this.trackInfos = ExoVlcUtil.vlc2exoTracks(media.getDuration(), vlctracks, lib); else try { if ((hasVdo = vlc.hasVideoTrack(uri))) this.trackInfos = ExoVlcUtil.getDummyVdoTrack(media, com.exovlc.ExoVlcUtil.DUMM_VDO_MIME); } catch (IOException e1) { e1.printStackTrace(); } ExoVlcUtil.log(this, "get vlc tracks for uri = " + uri); }
Example #9
Source File: VLCRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public void buildRenderers(DemoPlayer player, RendererBuilderCallback callback) { TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT]; try { VLCSampleExtractor extractor = new VLCSampleExtractor(vlc, uri); VLCSampleSource vlcsource = new VLCSampleSource(extractor); MySurfaceLayoutHandler msh = null; System.out.println("VLCRendererBuilder.buildRenderers() props = "+props); Object v = props.get(SURFACE_VIEW_RES_ID_PROP); if (v instanceof Integer) msh = new MySurfaceLayoutHandler(this.context, ((Integer) v).intValue()); if (msh == null) callback.onRenderersError(new ExoPlaybackException("property " + SURFACE_VIEW_RES_ID_PROP + " not set")); VLCVideoSurfaceHandler ivdoplayer = new VLCVideoSurfaceHandler( extractor.getLibVLC(), player.getMainHandler(), player, msh); renderers[DemoPlayer.TYPE_VIDEO] = new VLCVideoTrackRenderer(vlcsource, player.getMainHandler(), player, ivdoplayer, extractor.getLibVLC()); renderers[DemoPlayer.TYPE_AUDIO] = new VLCAudioTrackRenderer(vlcsource, player.getMainHandler(), player, extractor.getLibVLC()); } catch (ExoPlaybackException e) { e.printStackTrace(); } callback.onRenderers(null, null, renderers); }
Example #10
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override protected void onReleased() throws ExoPlaybackException { System.out.println(">>>> VLCTrackRenderer.onReleased()>>>>"); super.onReleased(); if (!vlc.isPlaying()) vlc.stop(); source.release(); }
Example #11
Source File: VLCRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
MySurfaceLayoutHandler(Context context, int sv_id) throws ExoPlaybackException { super(); this.activityCtx = context; try { view = (SurfaceView) ((Activity) activityCtx).findViewById(sv_id);// R.id.surface_view); } catch (Exception e) { e.printStackTrace(); throw new ExoPlaybackException(e); } pw = ((Activity) activityCtx).getWindow().getDecorView().getWidth(); ph = ((Activity) activityCtx).getWindow().getDecorView().getHeight(); }
Example #12
Source File: DebugTrackRenderer.java From google-media-framework-android with Apache License 2.0 | 5 votes |
@Override protected void doSomeWork(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException { maybeFail(); if (positionUs < currentPositionUs || positionUs > currentPositionUs + 1000000) { currentPositionUs = positionUs; textView.post(this); } }
Example #13
Source File: ExoVlcUtil.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public static org.videolan.libvlc.Media getMedia(LibVLC vlc, String uri) throws ExoPlaybackException { System.out.println(">> ExoVlcUtil.getMedia() uri = " + uri); org.videolan.libvlc.Media media = new org.videolan.libvlc.Media(vlc, uri); boolean parsed = media.parse(org.videolan.libvlc.Media.Parse.FetchNetwork); media.release(); System.out.println("ExoVlcUtil.getMedia() is parsed media=" + media.isParsed()); System.out.println("ExoVlcUtil.getMedia() media duration ="); MediaList mlist = media.subItems(); System.out.println("ExoVlcUtil.getMedia() sub item =" + mlist); if (mlist != null) { System.out.println(">>> ExoVlcUtil.getMedia() parsed media subItems count : " + mlist.getCount()); for (int i = 0; i < mlist.getCount(); i++) { System.out.println(">>> ExoVlcUtil.getMedia() parsed media subItems item (" + i + ") : " + mlist.getMediaAt(i).getType() + " track count " + mlist.getMediaAt(i).getTrackCount()); } } System.out.println(">>> ExoVlcUtil.getMedia() parsed media dump tracks : " + media.getTrackCount()); for (int i = 0; i < media.getTrackCount(); i++) { System.out.println(">>> ExoVlcUtil.getMedia() parsed media track[" + i + "]:" + media.getTrack(i).type); } // try { // boolean hv =vlc.hasVideoTrack(uri); // System.out.println(">>> ExoVlcUtil.getMedia() HAS VDO="+hv); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // if (!parsed) throw new ExoPlaybackException("Unable to parse media " + uri); return media; }
Example #14
Source File: VLCRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public VLCRendererBuilder(Context context, Uri uri, Properties props) throws ExoPlaybackException { this.context = context; this.uri = LibVLC.PathToURI(uri.toString()); this.vlc = ExoVlcUtil.getVLC(context); this.props = props; }
Example #15
Source File: VLCAudioTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public void handleMessage(int messageType, Object message) throws ExoPlaybackException { if (messageType == com.google.android.exoplayer.MediaCodecAudioTrackRenderer.MSG_SET_VOLUME) { /* the volume in percents (0 = mute, 100 = 0dB) */ int v = com.exovlc.ExoVlcUtil.media2vlcVolume((Float) message); if (vlc.setVolume(v) == -1) ExoVlcUtil.log(this, "Err when setting VLC audio level :" + v); ; } else { super.handleMessage(messageType, message); } }
Example #16
Source File: VLCVideoTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public void handleMessage(int messageType, Object message) throws ExoPlaybackException { if (messageType == com.google.android.exoplayer.MediaCodecVideoTrackRenderer.MSG_SET_SURFACE) { ExoVlcUtil.log(this, ">>> VLCVideoTrackRenderer.handleMessage() >>> surface = " + (Surface) message); Thread.dumpStack(); this.surfaceHdl.setVlcSurface((Surface) message, false); } else { super.handleMessage(messageType, message); } }
Example #17
Source File: PlayerActivity.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
private RendererBuilder getRendererBuilder() { String userAgent = DemoUtil.getUserAgent(this); switch (contentType) { case DemoUtil.TYPE_SS: return new SmoothStreamingRendererBuilder(userAgent, contentUri.toString(), contentId, new SmoothStreamingTestMediaDrmCallback(), debugTextView); case DemoUtil.TYPE_DASH: return new DashRendererBuilder(userAgent, contentUri.toString(), contentId, new WidevineTestMediaDrmCallback(contentId), debugTextView); case DemoUtil.TYPE_HLS: return new HlsRendererBuilder(userAgent, contentUri.toString(), contentId); case DemoUtil.TYPE_RAW_HTTP_TS: case DemoUtil.TYPE_RAW_HTTP_MP4: try { System.out.println(">>>> PlayerActivity.getRendererBuilder()ACTIVE_VLC_TEST_BUILDER = "+ACTIVE_VLC_TEST_BUILDER); if (ACTIVE_VLC_TEST_BUILDER) { Properties p = new Properties(); p.put(com.exovlc.demo.VLCRendererBuilder.SURFACE_VIEW_RES_ID_PROP, Integer.valueOf(R.id.surface_view) ); return new com.exovlc.demo.VLCRendererBuilder(this, contentUri ,p); } return new RawHttpRendererBuilder(this, userAgent, contentUri.toString(), debugTextView, contentType); } catch (ExoPlaybackException e) { // TODO Auto-generated catch block e.printStackTrace(); } case DemoUtil.TYPE_UDP: return new UdpMulticastRendererBuilder(this, userAgent, contentUri.toString(), debugTextView, contentType); case DemoUtil.TYPE_RTP: return new UdpRtpRendererBuilder(this, userAgent, contentUri.toString(), debugTextView, contentType); case DemoUtil.TYPE_UDP_UNICAST: return new UdpUnicastRendererBuilder(this, userAgent, contentUri.toString(), debugTextView, contentType); default: return new DefaultRendererBuilder(this, contentUri, debugTextView); } }
Example #18
Source File: DemoPlayer.java From Android-Example-HLS-ExoPlayer with Apache License 2.0 | 5 votes |
@Override public void onPlayerError(ExoPlaybackException exception) { rendererBuildingState = RENDERER_BUILDING_STATE_IDLE; for (Listener listener : listeners) { listener.onError(exception); } }
Example #19
Source File: VLCAudioTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public void handleMessage(int messageType, Object message) throws ExoPlaybackException { if (messageType == com.google.android.exoplayer.MediaCodecAudioTrackRenderer.MSG_SET_VOLUME) { /* the volume in percents (0 = mute, 100 = 0dB) */ int v = com.exovlc.ExoVlcUtil.media2vlcVolume((Float) message); if (vlc.setVolume(v) == -1) ExoVlcUtil.log(this, "Err when setting VLC audio level :" + v); ; } else { super.handleMessage(messageType, message); } }
Example #20
Source File: VLCVideoTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public void handleMessage(int messageType, Object message) throws ExoPlaybackException { if (messageType == com.google.android.exoplayer.MediaCodecVideoTrackRenderer.MSG_SET_SURFACE) { ExoVlcUtil.log(this, ">>> VLCVideoTrackRenderer.handleMessage() >>> surface = " + (Surface) message); Thread.dumpStack(); this.surfaceHdl.setVlcSurface((Surface) message, false); } else { super.handleMessage(messageType, message); } }
Example #21
Source File: VideoActivity.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
/************* * Player *************/ LibVLC getLibVLC(){ if(true) try { return com.exovlc.ExoVlcUtil.getVLC(this); } catch (ExoPlaybackException e1) { // TODO Auto-generated catch block e1.printStackTrace(); finish(); } throw new IllegalStateException(); }
Example #22
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override protected void onStopped() throws ExoPlaybackException { super.onStopped(); System.out.println(">>>> VLCTrackRenderer.onStopped() >>>> "); if (!vlc.isPlaying()) vlc.pause(); }
Example #23
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override protected void doSomeWork(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException { if (vlc != null) { // if(!vlc.isPlaying() && !isEnded) // was playing // isEnded = !vlc.isPlaying(); } // System.out.println(">> VLCTrackRenderer.doSomeWork() is ended ="+isEnded // +" is play ="+vlc.isPlaying()); // if (vlc != null && vlc.isPlaying()) // vlc.getPosition() }
Example #24
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override protected void seekTo(long positionUs) throws ExoPlaybackException { System.out.println("VLCTrackRenderer.seekTo(positionUs=" + positionUs + ")"); Thread.dumpStack(); source.seekToUs(positionUs); float per = vlc.getPosition(); System.out.println("VLCTrackRenderer.seekTo() new per_pos==" + positionUs + " dur =" + getDurationUs()); currentPositionUs = (long) ((double) getDurationUs() * per); System.out.println("VLCTrackRenderer.seekTo(currentPositionUs=" + currentPositionUs + ")"); // sourceState = SOURCE_STATE_NOT_READY; isEnded = false; }
Example #25
Source File: VLCTrackRenderer.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override protected void onEnabled(long positionUs, boolean joining) throws ExoPlaybackException { System.out.println("VLCTrackRenderer.onEnabled()"); super.onEnabled(positionUs, joining); source.enable(trackIndex, positionUs); // sourceState = SOURCE_STATE_NOT_READY; isEnded = false; float per = vlc.getPosition(); currentPositionUs = (long) ((double) getDurationUs() * per); }
Example #26
Source File: ExoVlcUtil.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public static org.videolan.libvlc.Media getMedia(LibVLC vlc, String uri) throws ExoPlaybackException { System.out.println(">> ExoVlcUtil.getMedia() uri = " + uri); org.videolan.libvlc.Media media = new org.videolan.libvlc.Media(vlc, uri); boolean parsed = media.parse(org.videolan.libvlc.Media.Parse.FetchNetwork); media.release(); System.out.println("ExoVlcUtil.getMedia() is parsed media=" + media.isParsed()); System.out.println("ExoVlcUtil.getMedia() media duration ="); MediaList mlist = media.subItems(); System.out.println("ExoVlcUtil.getMedia() sub item =" + mlist); if (mlist != null) { System.out.println(">>> ExoVlcUtil.getMedia() parsed media subItems count : " + mlist.getCount()); for (int i = 0; i < mlist.getCount(); i++) { System.out.println(">>> ExoVlcUtil.getMedia() parsed media subItems item (" + i + ") : " + mlist.getMediaAt(i).getType() + " track count " + mlist.getMediaAt(i).getTrackCount()); } } System.out.println(">>> ExoVlcUtil.getMedia() parsed media dump tracks : " + media.getTrackCount()); for (int i = 0; i < media.getTrackCount(); i++) { System.out.println(">>> ExoVlcUtil.getMedia() parsed media track[" + i + "]:" + media.getTrack(i).type); } // try { // boolean hv =vlc.hasVideoTrack(uri); // System.out.println(">>> ExoVlcUtil.getMedia() HAS VDO="+hv); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // if (!parsed) throw new ExoPlaybackException("Unable to parse media " + uri); return media; }
Example #27
Source File: MultiTrackChunkSource.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public void handleMessage(int what, Object msg) throws ExoPlaybackException { Assertions.checkState(!enabled); if (what == MSG_SELECT_TRACK) { selectedSource = allSources[(Integer) msg]; } }
Example #28
Source File: VLCRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
MySurfaceLayoutHandler(Context context, int sv_id) throws ExoPlaybackException { super(); this.activityCtx = context; try { view = (SurfaceView) ((Activity) activityCtx).findViewById(sv_id);// R.id.surface_view); } catch (Exception e) { e.printStackTrace(); throw new ExoPlaybackException(e); } pw = ((Activity) activityCtx).getWindow().getDecorView().getWidth(); ph = ((Activity) activityCtx).getWindow().getDecorView().getHeight(); }
Example #29
Source File: VLCRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
public VLCRendererBuilder(Context context, Uri uri, Properties props) throws ExoPlaybackException { this.context = context; this.uri = LibVLC.PathToURI(uri.toString()); this.vlc = ExoVlcUtil.getVLC(context); this.props = props; }
Example #30
Source File: VLCRendererBuilder.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@Override public void buildRenderers(DemoPlayer player, RendererBuilderCallback callback) { TrackRenderer[] renderers = new TrackRenderer[DemoPlayer.RENDERER_COUNT]; try { VLCSampleExtractor extractor = new VLCSampleExtractor(vlc, uri); VLCSampleSource vlcsource = new VLCSampleSource(extractor); MySurfaceLayoutHandler msh = null; System.out.println("VLCRendererBuilder.buildRenderers() props = "+props); Object v = props.get(SURFACE_VIEW_RES_ID_PROP); if (v instanceof Integer) msh = new MySurfaceLayoutHandler(this.context, ((Integer) v).intValue()); if (msh == null) callback.onRenderersError(new ExoPlaybackException("property " + SURFACE_VIEW_RES_ID_PROP + " not set")); VLCVideoSurfaceHandler ivdoplayer = new VLCVideoSurfaceHandler( extractor.getLibVLC(), player.getMainHandler(), player, msh); renderers[DemoPlayer.TYPE_VIDEO] = new VLCVideoTrackRenderer(vlcsource, player.getMainHandler(), player, ivdoplayer, extractor.getLibVLC()); renderers[DemoPlayer.TYPE_AUDIO] = new VLCAudioTrackRenderer(vlcsource, player.getMainHandler(), player, extractor.getLibVLC()); } catch (ExoPlaybackException e) { e.printStackTrace(); } callback.onRenderers(null, null, renderers); }