我有一个小问题,希望有人可以帮助我。 今天,我注意到我的音乐应用无法在ChromeCast设备上播放媒体。寻求请求返回成功,但它实际上并不寻求。
我只是打电话:
public void seek(long position) { //position is in milliseconds
if (mListener != null)
mListener.onSeekStatusChange(true);
Log.e(TAG, "Seeking to: " + position + " - position: " + mMediaPlayer.getApproximateStreamPosition());
if (mApiClient != null && mMediaPlayer != null) {
mMediaPlayer.seek(mApiClient, position, RemoteMediaPlayer.RESUME_STATE_UNCHANGED).setResultCallback(
new ResultCallback<MediaChannelResult>() {
@Override
public void onResult(MediaChannelResult result) {
Status status = result.getStatus();
if (status.isSuccess()) {
if (mListener != null)
mListener.onSeekStatusChange(false);
} else {
Log.w(TAG, "Unable to seek: " + status.getStatusCode());
}
}
});
}
}
例如,我将获得&#34;寻求:103018 - 位置:35709&#34;在logcat中,如果我检查status.isSuccess()的值,它将返回true。
Chromecast控制台会给我这样的内容:
[536.007s] [cast.receiver.IpcChannel] Received message: {"data":"{\"currentTime\":165.395,\"type\":\"SEEK\",\"requestId\":17,\"mediaSessionId\":3}","namespace":"urn:x-cast:com.google.cast.media","senderId":"3:com.app.groovemobile-49"} cast_receiver.js:18
[536.011s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message cast_receiver.js:18
[536.017s] [cast.receiver.MediaManager] MediaManager message received cast_receiver.js:18
[536.021s] [cast.receiver.MediaManager] Dispatching MediaManager seek event cast_receiver.js:18
[536.030s] [cast.receiver.MediaManager] onSeek: {"currentTime":165.395,"requestId":17,"mediaSessionId":3} cast_receiver.js:18
[536.034s] [cast.receiver.MediaManager] Sending broadcast status message cast_receiver.js:18
[536.040s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":3,\"playbackRate\":1,\"playerState\":\"BUFFERING\",\"currentTime\":99.691977,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false}}],\"requestId\":17}"} cast_receiver.js:18
[536.994s] [cast.receiver.MediaManager] Buffering state changed, isPlayerBuffering: false old time: 99.691977 current time: 100.728155 cast_receiver.js:18
[536.999s] [cast.receiver.MediaManager] Sending broadcast status message cast_receiver.js:18
[537.002s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":3,\"playbackRate\":1,\"playerState\":\"PLAYING\",\"currentTime\":100.728155,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false}}],\"requestId\":0}"}
我不知道发生了什么。
提前致谢!