Java Code Examples for com.google.android.exoplayer2.source.MediaPeriod#continueLoading()
The following examples show how to use
com.google.android.exoplayer2.source.MediaPeriod#continueLoading() .
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: DownloadHelper.java From MediaSDK with Apache License 2.0 | 4 votes |
@Override public boolean handleMessage(Message msg) { switch (msg.what) { case MESSAGE_PREPARE_SOURCE: mediaSource.prepareSource(/* caller= */ this, /* mediaTransferListener= */ null); mediaSourceHandler.sendEmptyMessage(MESSAGE_CHECK_FOR_FAILURE); return true; case MESSAGE_CHECK_FOR_FAILURE: try { if (mediaPeriods == null) { mediaSource.maybeThrowSourceInfoRefreshError(); } else { for (int i = 0; i < pendingMediaPeriods.size(); i++) { pendingMediaPeriods.get(i).maybeThrowPrepareError(); } } mediaSourceHandler.sendEmptyMessageDelayed( MESSAGE_CHECK_FOR_FAILURE, /* delayMillis= */ 100); } catch (IOException e) { downloadHelperHandler .obtainMessage(DOWNLOAD_HELPER_CALLBACK_MESSAGE_FAILED, /* obj= */ e) .sendToTarget(); } return true; case MESSAGE_CONTINUE_LOADING: MediaPeriod mediaPeriod = (MediaPeriod) msg.obj; if (pendingMediaPeriods.contains(mediaPeriod)) { mediaPeriod.continueLoading(/* positionUs= */ 0); } return true; case MESSAGE_RELEASE: if (mediaPeriods != null) { for (MediaPeriod period : mediaPeriods) { mediaSource.releasePeriod(period); } } mediaSource.releaseSource(this); mediaSourceHandler.removeCallbacksAndMessages(null); mediaSourceThread.quit(); return true; default: return false; } }
Example 2
Source File: DownloadHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public boolean handleMessage(Message msg) { switch (msg.what) { case MESSAGE_PREPARE_SOURCE: mediaSource.prepareSource(/* listener= */ this, /* mediaTransferListener= */ null); mediaSourceHandler.sendEmptyMessage(MESSAGE_CHECK_FOR_FAILURE); return true; case MESSAGE_CHECK_FOR_FAILURE: try { if (mediaPeriods == null) { mediaSource.maybeThrowSourceInfoRefreshError(); } else { for (int i = 0; i < pendingMediaPeriods.size(); i++) { pendingMediaPeriods.get(i).maybeThrowPrepareError(); } } mediaSourceHandler.sendEmptyMessageDelayed( MESSAGE_CHECK_FOR_FAILURE, /* delayMillis= */ 100); } catch (IOException e) { downloadHelperHandler .obtainMessage(DOWNLOAD_HELPER_CALLBACK_MESSAGE_FAILED, /* obj= */ e) .sendToTarget(); } return true; case MESSAGE_CONTINUE_LOADING: MediaPeriod mediaPeriod = (MediaPeriod) msg.obj; if (pendingMediaPeriods.contains(mediaPeriod)) { mediaPeriod.continueLoading(/* positionUs= */ 0); } return true; case MESSAGE_RELEASE: if (mediaPeriods != null) { for (MediaPeriod period : mediaPeriods) { mediaSource.releasePeriod(period); } } mediaSource.releaseSource(this); mediaSourceHandler.removeCallbacksAndMessages(null); mediaSourceThread.quit(); return true; default: return false; } }
Example 3
Source File: DownloadHelper.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public boolean handleMessage(Message msg) { switch (msg.what) { case MESSAGE_PREPARE_SOURCE: mediaSource.prepareSource(/* listener= */ this, /* mediaTransferListener= */ null); mediaSourceHandler.sendEmptyMessage(MESSAGE_CHECK_FOR_FAILURE); return true; case MESSAGE_CHECK_FOR_FAILURE: try { if (mediaPeriods == null) { mediaSource.maybeThrowSourceInfoRefreshError(); } else { for (int i = 0; i < pendingMediaPeriods.size(); i++) { pendingMediaPeriods.get(i).maybeThrowPrepareError(); } } mediaSourceHandler.sendEmptyMessageDelayed( MESSAGE_CHECK_FOR_FAILURE, /* delayMillis= */ 100); } catch (IOException e) { downloadHelperHandler .obtainMessage(DOWNLOAD_HELPER_CALLBACK_MESSAGE_FAILED, /* obj= */ e) .sendToTarget(); } return true; case MESSAGE_CONTINUE_LOADING: MediaPeriod mediaPeriod = (MediaPeriod) msg.obj; if (pendingMediaPeriods.contains(mediaPeriod)) { mediaPeriod.continueLoading(/* positionUs= */ 0); } return true; case MESSAGE_RELEASE: if (mediaPeriods != null) { for (MediaPeriod period : mediaPeriods) { mediaSource.releasePeriod(period); } } mediaSource.releaseSource(this); mediaSourceHandler.removeCallbacksAndMessages(null); mediaSourceThread.quit(); return true; default: return false; } }