本文整理汇总了Java中android.support.v7.media.MediaSessionStatus类的典型用法代码示例。如果您正苦于以下问题:Java MediaSessionStatus类的具体用法?Java MediaSessionStatus怎么用?Java MediaSessionStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MediaSessionStatus类属于android.support.v7.media包,在下文中一共展示了MediaSessionStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: endSession
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private void endSession() {
if (mSessionId == null) {
return;
}
Intent intent = new Intent(MediaControlIntent.ACTION_END_SESSION);
intent.addCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
intent.putExtra(MediaControlIntent.EXTRA_SESSION_ID, mSessionId);
sendIntentToRoute(intent, new ResultBundleHandler() {
@Override
public void handleResult(final Bundle bundle) {
MediaSessionStatus status = MediaSessionStatus.fromBundle(
bundle.getBundle(MediaControlIntent.EXTRA_SESSION_STATUS));
int sessionState = status.getSessionState();
Log.d(TAG, "session state after ending session: " + sessionState);
clearCurrentMediaItem();
}
});
mSessionId = null;
}
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:21,代码来源:MrpCastPlayerActivity.java
示例2: handleGetSessionStatus
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private boolean handleGetSessionStatus(Intent intent, ControlRequestCallback callback) {
String sid = intent.getStringExtra(MediaControlIntent.EXTRA_SESSION_ID);
MediaSessionStatus sessionStatus = mSessionManager.getSessionStatus(sid);
if (callback != null) {
if (sessionStatus != null) {
Bundle result = new Bundle();
result.putBundle(MediaControlIntent.EXTRA_SESSION_STATUS,
mSessionManager.getSessionStatus(sid).asBundle());
callback.onResult(result);
} else {
callback.onError("Failed to get session status, sid=" + sid, null);
}
}
return (sessionStatus != null);
}
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:17,代码来源:SampleMediaRouteProvider.java
示例3: handleEndSession
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private boolean handleEndSession(Intent intent, ControlRequestCallback callback) {
String sid = intent.getStringExtra(MediaControlIntent.EXTRA_SESSION_ID);
boolean success = (sid != null) && sid.equals(mSessionManager.getSessionId())
&& mSessionManager.endSession();
if (callback != null) {
if (success) {
Bundle result = new Bundle();
MediaSessionStatus sessionStatus = new MediaSessionStatus.Builder(
MediaSessionStatus.SESSION_STATE_ENDED).build();
result.putBundle(MediaControlIntent.EXTRA_SESSION_STATUS, sessionStatus.asBundle());
callback.onResult(result);
handleSessionStatusChange(sid);
mSessionReceiver = null;
} else {
callback.onError("Failed to end session, sid=" + sid, null);
}
}
return success;
}
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:20,代码来源:SampleMediaRouteProvider.java
示例4: processSessionStatusBundle
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private void processSessionStatusBundle(Bundle statusBundle) {
MediaSessionStatus status = MediaSessionStatus.fromBundle(
statusBundle.getBundle(MediaControlIntent.EXTRA_SESSION_STATUS));
int sessionState = status.getSessionState();
// If no change do nothing
if (sessionState == mSessionState) return;
mSessionState = sessionState;
switch (sessionState) {
case MediaSessionStatus.SESSION_STATE_ACTIVE:
if (mLocalVideoUri != null) {
startPlayback(mPreferredTitle, mStartPositionMillis);
}
break;
case MediaSessionStatus.SESSION_STATE_ENDED:
case MediaSessionStatus.SESSION_STATE_INVALIDATED:
for (UiListener listener : getUiListeners()) {
listener.onPlaybackStateChanged(PlayerState.INVALIDATED);
}
if (getMediaStateListener() != null) {
getMediaStateListener().onPlaybackStateChanged(PlayerState.INVALIDATED);
}
// Record the remaining time UMA first, otherwise the playback state will be cleared
// in release().
recordRemainingTimeUMA();
// Set the current session id to null so we don't send the stop intent.
mCurrentSessionId = null;
release();
break;
default:
break;
}
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:37,代码来源:DefaultMediaRouteController.java
示例5: logMediaSessionStatus
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
@RemovableInRelease
private void logMediaSessionStatus(Bundle data) {
MediaSessionStatus status = MediaSessionStatus.fromBundle(
data.getBundle(MediaControlIntent.EXTRA_SESSION_STATUS));
int sessionState = status.getSessionState();
Log.d(TAG, "Session state after ending session: %s", sessionState);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:8,代码来源:DefaultMediaRouteController.java
示例6: type
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
public static SubjectFactory<MediaSessionStatusSubject, MediaSessionStatus> type() {
return new SubjectFactory<MediaSessionStatusSubject, MediaSessionStatus>() {
@Override
public MediaSessionStatusSubject getSubject(FailureStrategy fs, MediaSessionStatus that) {
return new MediaSessionStatusSubject(fs, that);
}
};
}
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:MediaSessionStatusSubject.java
示例7: onItemStatusChanged
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
@Override
public void onItemStatusChanged(Bundle data,
String sessionId, MediaSessionStatus sessionStatus,
String itemId, MediaItemStatus itemStatus) {
logStatus("onItemStatusChanged", sessionId, sessionStatus, itemId, itemStatus);
if (mCallback != null) {
if (itemStatus.getPlaybackState() ==
MediaItemStatus.PLAYBACK_STATE_FINISHED) {
mCallback.onCompletion();
} else if (itemStatus.getPlaybackState() ==
MediaItemStatus.PLAYBACK_STATE_ERROR) {
mCallback.onError();
}
}
}
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:16,代码来源:RemotePlayer.java
示例8: onSessionStatusChanged
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
@Override
public void onSessionStatusChanged(Bundle data,
String sessionId, MediaSessionStatus sessionStatus) {
logStatus("onSessionStatusChanged", sessionId, sessionStatus, null, null);
if (mCallback != null) {
mCallback.onPlaylistChanged();
}
}
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:9,代码来源:RemotePlayer.java
示例9: logStatus
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private void logStatus(String message,
String sessionId, MediaSessionStatus sessionStatus,
String itemId, MediaItemStatus itemStatus) {
if (DEBUG) {
String result = "";
if (sessionId != null && sessionStatus != null) {
result += "sessionId=" + sessionId + ", sessionStatus=" + sessionStatus;
}
if (itemId != null & itemStatus != null) {
result += (result.isEmpty() ? "" : ", ")
+ "itemId=" + itemId + ", itemStatus=" + itemStatus;
}
Log.d(TAG, message + ": " + result);
}
}
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:16,代码来源:RemotePlayer.java
示例10: getSessionStatus
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
MediaSessionStatus getSessionStatus(String sid) {
int sessionState = (sid != null && sid.equals(mSessionId)) ?
MediaSessionStatus.SESSION_STATE_ACTIVE :
MediaSessionStatus.SESSION_STATE_INVALIDATED;
return new MediaSessionStatus.Builder(sessionState)
.setQueuePaused(mPaused)
.build();
}
开发者ID:benhysell,项目名称:V.FlyoutTest,代码行数:10,代码来源:SessionManager.java
示例11: configureNewSession
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private void configureNewSession(Bundle data) {
mCurrentSessionId = data.getString(MediaControlIntent.EXTRA_SESSION_ID);
mSessionState = MediaSessionStatus.SESSION_STATE_INVALIDATED;
Log.d(TAG, "Got a session id: %s", mCurrentSessionId);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:6,代码来源:DefaultMediaRouteController.java
示例12: MediaSessionStatusSubject
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
protected MediaSessionStatusSubject(FailureStrategy failureStrategy, MediaSessionStatus subject) {
super(failureStrategy, subject);
}
开发者ID:pkware,项目名称:truth-android,代码行数:4,代码来源:MediaSessionStatusSubject.java
示例13: configureNewSession
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private void configureNewSession(Bundle data) {
mCurrentSessionId = data.getString(MediaControlIntent.EXTRA_SESSION_ID);
mSessionState = MediaSessionStatus.SESSION_STATE_INVALIDATED;
RemotePlaybackSettings.setSessionId(getContext(), mCurrentSessionId);
if (mDebug) Log.d(TAG, "Got a session id: " + mCurrentSessionId);
}
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:7,代码来源:DefaultMediaRouteController.java
示例14: processSessionStatusBundle
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
private void processSessionStatusBundle(Bundle statusBundle) {
Log.d(TAG, "processSessionStatusBundle()");
String sessionId = statusBundle.getString(MediaControlIntent.EXTRA_SESSION_ID);
MediaSessionStatus status = MediaSessionStatus.fromBundle(
statusBundle.getBundle(MediaControlIntent.EXTRA_SESSION_STATUS));
int sessionState = status.getSessionState();
Log.d(TAG, "got a session status update for session " + sessionId + ", state = "
+ sessionState + ", mSessionId=" + mSessionId);
if (mSessionId == null) {
return;
}
if (!mSessionId.equals(sessionId)) {
// Got status on a session other than the one we're tracking. Ignore it.
Log.d(TAG, "Received status for unknown session: " + sessionId);
return;
}
switch (sessionState) {
case MediaSessionStatus.SESSION_STATE_ACTIVE:
Log.d(TAG, "session " + sessionId + " is ACTIVE");
mSessionActive = true;
syncStatus();
break;
case MediaSessionStatus.SESSION_STATE_ENDED:
Log.d(TAG, "session " + sessionId + " is ENDED");
mSessionId = null;
mSessionActive = false;
clearCurrentMediaItem();
break;
case MediaSessionStatus.SESSION_STATE_INVALIDATED:
Log.d(TAG, "session " + sessionId + " is INVALIDATED");
mSessionId = null;
mSessionActive = false;
clearCurrentMediaItem();
break;
default:
Log.d(TAG, "Received unexpected session state: " + sessionState);
break;
}
updateButtonStates();
}
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:50,代码来源:MrpCastPlayerActivity.java
示例15: MediaSessionStatusAssert
import android.support.v7.media.MediaSessionStatus; //导入依赖的package包/类
public MediaSessionStatusAssert(MediaSessionStatus actual) {
super(actual, MediaSessionStatusAssert.class);
}
开发者ID:square,项目名称:assertj-android,代码行数:4,代码来源:MediaSessionStatusAssert.java
注:本文中的android.support.v7.media.MediaSessionStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论