gpt4 book ai didi

android - 如何在另一个应用程序开始转换时停止转换?

转载 作者:搜寻专家 更新时间:2023-11-01 09:41:03 25 4
gpt4 key购买 nike

我运行两个应用程序,它们都使用 Cast SDK v2 和 Remote Display API。我从 App #1 开始转换,然后转到 App #2,按下转换按钮并选择一条路线。

预期:应用 #2 开始转换,应用 #1 停止转换。

实际:在我选择路线后,立即调用应用程序 #2 的 MediaRouter.Callback.onRouteUnselected()。这两个应用的内容都不会显示在接收器上,但应用 #1 的通知 Controller 仍然存在。

我在 Cast SDK v3 中没有看到这种行为。 Cast SDK v2 中是否有任何方法可以确保在另一个应用程序开始转换时先前的转换 session 停止?

最佳答案

我还没有这样做,但你可以尝试实现一个 addUpdateListener并执行 session.stop当另一个开始时。

addUpdateListener(listener)

Adds a listener that is invoked when the Session has changed. Changes to the following properties will trigger the listener: statusText, namespaces, status, and the volume of the receiver.

Listeners should check the status property of the Session to determine its connection status. The boolean parameter isAlive is deprecated in favor of the status Session property. The isAlive parameter is still passed in for backwards compatibility, and is true unless

status = chrome.cast.SessionStatus.STOPPED

停止应用程序方法:

function stopApp() {
session.stop(onSuccess, onError);
}

关于android - 如何在另一个应用程序开始转换时停止转换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39797951/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com