本文整理匯總了Java中com.google.android.exoplayer.ExoPlaybackException類的典型用法代碼示例。如果您正苦於以下問題:Java ExoPlaybackException類的具體用法?Java ExoPlaybackException怎麽用?Java ExoPlaybackException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ExoPlaybackException類屬於com.google.android.exoplayer包,在下文中一共展示了ExoPlaybackException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: VLCSampleExtractor
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
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);
}
示例2: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
protected boolean doPrepare(long positionUs) throws ExoPlaybackException {
boolean sourcePrepared = mSource.prepare(positionUs);
if (!sourcePrepared) {
return false;
}
for (int i = 0; i < mSource.getTrackCount(); i++) {
if (handlesMimeType(mSource.getFormat(i).mimeType)) {
if (mTrackIndex < 0) {
mTrackIndex = i;
}
mTracksIndex.add(i);
}
}
// TODO: Check this case. Source does not have the proper mime type.
return true;
}
示例3: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
protected boolean doPrepare(long positionUs) throws ExoPlaybackException {
boolean sourcePrepared = mSource.prepare(positionUs);
if (!sourcePrepared) {
return false;
}
int trackCount = mSource.getTrackCount();
for (int i = 0; i < trackCount; ++i) {
MediaFormat trackFormat = mSource.getFormat(i);
if (handlesMimeType(trackFormat.mimeType)) {
mTrackIndex = i;
clearDecodeState();
return true;
}
}
// TODO: Check this case. (Source do not have the proper mime type.)
return true;
}
示例4: doSomeWork
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
protected void doSomeWork(long positionUs, long elapsedRealtimeUs)
throws ExoPlaybackException {
source.continueBuffering(trackIndex, positionUs);
if (!inputStreamEnded && pendingMetadata == null) {
int result = source.readData(trackIndex, positionUs, formatHolder, sampleHolder, false);
if (result == SampleSource.SAMPLE_READ) {
pendingMetadataTimestamp = sampleHolder.timeUs;
try {
pendingMetadata = metadataParser.parse(sampleHolder.data.array(), sampleHolder.size);
} catch (IOException e) {
throw new ExoPlaybackException(e);
}
sampleHolder.data.clear();
} else if (result == SampleSource.END_OF_STREAM) {
inputStreamEnded = true;
}
}
if (pendingMetadata != null && pendingMetadataTimestamp <= positionUs) {
invokeRenderer(pendingMetadata);
pendingMetadata = null;
}
}
示例5: onDisabled
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
protected void onDisabled() throws ExoPlaybackException {
inputBuffer = null;
outputBuffer = null;
format = null;
audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
try {
if (decoder != null) {
decoder.release();
decoder = null;
codecCounters.codecReleaseCount++;
}
audioTrack.release();
} finally {
super.onDisabled();
}
}
示例6: doSomeWork
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
protected void doSomeWork(long positionUs, long elapsedRealtimeUs, boolean sourceIsReady)
throws ExoPlaybackException {
if (!inputStreamEnded && pendingMetadata == null) {
sampleHolder.clearData();
int result = readSource(positionUs, formatHolder, sampleHolder);
if (result == SampleSource.SAMPLE_READ) {
pendingMetadataTimestamp = sampleHolder.timeUs;
try {
pendingMetadata = metadataParser.parse(sampleHolder.data.array(), sampleHolder.size);
} catch (IOException e) {
throw new ExoPlaybackException(e);
}
} else if (result == SampleSource.END_OF_STREAM) {
inputStreamEnded = true;
}
}
if (pendingMetadata != null && pendingMetadataTimestamp <= positionUs) {
invokeRenderer(pendingMetadata);
pendingMetadata = null;
}
}
示例7: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@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 (subtitleParser.canParse(source.getTrackInfo(i).mimeType)) {
trackIndex = i;
return TrackRenderer.STATE_PREPARED;
}
}
return TrackRenderer.STATE_IGNORE;
}
示例8: onStarted
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@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();
}
示例9: VLCVideoSurfaceHandler
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
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.");
}
示例10: onStarted
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@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);
}
}
示例11: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@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;
}
示例12: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@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;
}
示例13: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@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;
}
示例14: doPrepare
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
protected int doPrepare(long positionUs) throws ExoPlaybackException {
boolean sourcePrepared = source.prepare(positionUs);
if (!sourcePrepared) {
return TrackRenderer.STATE_UNPREPARED;
}
int trackCount = source.getTrackCount();
for (int i = 0; i < trackCount; i++) {
if (source.getTrackInfo(i).mimeType.equalsIgnoreCase(MimeTypes.VIDEO_VP9)
|| source.getTrackInfo(i).mimeType.equalsIgnoreCase(MimeTypes.VIDEO_WEBM)) {
trackIndex = i;
return TrackRenderer.STATE_PREPARED;
}
}
return TrackRenderer.STATE_IGNORE;
}
示例15: onPlayerError
import com.google.android.exoplayer.ExoPlaybackException; //導入依賴的package包/類
@Override
public void onPlayerError(ExoPlaybackException exception) {
rendererBuildingState = RENDERER_BUILDING_STATE_IDLE;
for (Listener listener : listeners) {
listener.onError(exception);
}
}