即使发布后视频也不会停止播放

发布于 2024-12-01 02:35:16 字数 356 浏览 1 评论 0原文

这可能是一个相当简单的答案,但我自己无法修复它。

因此,在我的应用程序中,我有一个页面,其中加载了 3 个在屏幕上播放的视频,并嵌入到 Web 视图中。我想要的只是让视频在导航回上一页时停止播放,因为目前,如果视频在单击返回时正在播放,则音频将继续在后台播放。即使我已经发布了网络视图:

-(void)dealloc {

[webView1 release];
[webView2 release];
[webView3 release];
[super dealloc];

}

无论我尝试什么,他们都会继续玩! 有人有什么想法吗?

谢谢,

马特

This is probably a fairly simple answer but I just can't manage to fix it myself.

So in my app, I have a page that loads with 3 videos playing on the screen, embedded in web views. All I want is for the videos to stop playing when they navigate back to the previous page because at the moment, if the video is playing when they click back, the audio will continue to play in the background. This is even though I have released the web views:

-(void)dealloc {

[webView1 release];
[webView2 release];
[webView3 release];
[super dealloc];

}

No matter what I try, they continue to play!
Any ideas anybody?

Thanks,

Matt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺渁∝ 2024-12-08 02:35:16

我只是在这里猜测,但看起来你有一个混合应用程序(本机代码 + HTML/JS/CSS)。

我假设视频正在 HTML5 视频播放器中播放?

在这种情况下,当视频开始时,它实际上会被传递到可能超出您控制范围的 MPMoviePlayerController 本机实例。

但是,释放 Web 视图不足以停止视频,可能是因为视频播放器的所有权位于 Web 视图之外。返回时,您必须运行某种 JavaScript 来停止视频。

当然,这依赖于您拥有混合应用程序的假设。

I'm only guessing here but it looks like you have a hybrid app (native code + HTML/JS/CSS).

I'll assume that the videos are being played in an HTML5 video player?

In that case, when the video starts, it's actually being handed off to a native instance of MPMoviePlayerController that is likely outside of your control.

However, releasing a web view won't be enough to stop the video, probably because ownership of the video player is outside of the web view. You'll have to run some kind of javascript to stop the video when navigating back.

Of course, this relies on the assumption that you have a hybrid app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文