1

这是我的openSession方法,基于样本的:

    Log.d("asdf", "Beginning session with context: " + mCastContext);
    Log.d("asdf", "The session to begin: " + mSession);
    mSession.setListener(new com.google.cast.ApplicationSession.Listener() {

        @Override
        public void onSessionStarted(ApplicationMetadata appMetadata) {
            Log.d("asdf", "Getting channel after session start");
            ApplicationChannel channel = mSession.getChannel();
            if (channel == null) {
                Log.e("asdf", "channel = null");
                return;
            }
            Log.d("asdf", "Creating and attaching Message Stream");
            mMessageStream = new MediaProtocolMessageStream();
            channel.attachMessageStream(mMessageStream);

            if (mMessageStream.getPlayerState() == null) {
                if (mMedia != null) {
                    loadMedia(mMedia);
                }
            } else {
                Log.d("asdf", "Found player already running");
//              updateStatus(); TODO
            }
        }

它运行良好,我可以在很短的时间内(通常大约 6 秒)将内容推送到 Leapcast(模拟器)。

然而,在那 6 秒之后,我得到了这个:

Log: onEnded failed to connect channel: network I/O timeout

从 调用onSessionEnded

究竟是什么结束了我的会话?这只是 Leapcast 的问题吗?我需要做某种保活吗?

4

0 回答 0