RemotePlaybackClient, stop () does not receive a callback

I am trying to write an example RemotePlaybackClient application, partly because the one published by Google fails aapt .

I can get RemotePlaybackClient to support play() , and it plays the video on Chromecast.

However, when I call stop() to stop the video from playing while Chromecast stops playing (it displays a black screen with a centered icon), the SessionActionCallback that I pass to the stop() call is not called using onResult() :

  private void stop() { logToTranscript(getActivity().getString(R.string.stop_requested)); SessionActionCallback stopCB=new SessionActionCallback() { @Override public void onResult(Bundle data, String sessionId, MediaSessionStatus sessionStatus) { logToTranscript(getActivity().getString(R.string.stopped)); isPlaying=false; isPaused=false; getActivity().supportInvalidateOptionsMenu(); endSession(); } }; client.stop(null, stopCB); } 

The same thing happens if I try to execute pause() - the SessionActionCallback passed to pause() is not called.

A sample code posted by Google shows that these callbacks should be called, but again, I cannot get this to successfully compile.

Does anyone know under what circumstances SessionActionCallback will not work, and ItemActionCallback used with play() will work?

UPDATE

I registered number 66996 and issue 67032 , the last of which is, in particular, a problem, I see here when I encounter this problem with an official example application.

+47
android chromecast google-cast
Mar 11 '14 at 16:38
source share
1 answer

I believe everyone. Answer how you make the connection. Because in the Google code, the code says that the client you made did not leave the session and should not be null.

 if (!mClient.hasSession()) { // ignore if no session return; 

/ ******* The rest of the code will not be available ********* /}

  @Override public void pause() { if (!mClient.hasSession()) { // ignore if no session return; } if (DEBUG) { Log.d(TAG, "pause"); } mClient.pause(null, new SessionActionCallback() { @Override public void onResult(Bundle data, String sessionId, MediaSessionStatus sessionStatus) { logStatus("pause: succeeded", sessionId, sessionStatus, null, null); if (mCallback != null) { mCallback.onPlaylistChanged(); } } @Override public void onError(String error, int code, Bundle data) { logError("pause: failed", error, code); } }); } 
+1
Jul 31 '14 at 13:58
source share



All Articles