切换选项卡时 GXT/GWT html 内容重新加载

发布于 2024-10-08 10:17:18 字数 202 浏览 0 评论 0原文

我正在从事 GXT/GWT 项目。我有两个选项卡,其中内容是根据下拉菜单中的选择设置的。一个选项卡中的内容是嵌入式视频(Google 视频或 YouTube 视频)。

问题是,切换选项卡时,视频会重新加载并从头开始。我想要的是能够切换选项卡,并在焦点切换到另一个选项卡时让视频继续播放或暂停。

一如既往,任何想法都将受到高度赞赏。

干杯, 本

I am working on a GXT/GWT project. I have two tabs in which content is set based on selections from a drop down menu. The content in one tab is an embedded video (Google Video or youtube video)

The problem is that when switching tabs, the video reloads and starts from the beginning again. What I would like is to be able to switch tabs and have the video continue to play or pause when the focus switches to another tab.

Any ideas, as always, are greatly appreciated.

Cheers,
Ben

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

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

发布评论

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

评论(4

醉生梦死 2024-10-15 10:17:18

我同意@mmohab。这是 iFrame 的行为,与 flash 无关。重新加载问题将通过使用 Gxt 的 HtmlContainer 类和 setUrl() 方法来解决,而不是使用 TabItemContentPanelsetUrl 方法。
HtmlContainer 将给定的 Html 或 Url 页面主体包装到 Div 标记而不是 iFrame:

HtmlContainer html = new HtmlContainer("www.youtube.com");
yourTabItemObj.add(html);

I'm agree with @mmohab. It's iFrame's behavior and doesn't related to flash. Reload problem will solve by using Gxt's HtmlContainer class and setUrl() method instead of using TabItem or ContentPanel's setUrl method.
HtmlContainer wraps your given Html or Url page body's to Div tag and not iFrame:

HtmlContainer html = new HtmlContainer("www.youtube.com");
yourTabItemObj.add(html);
海夕 2024-10-15 10:17:18

这是因为您使用 IFRAME 进行嵌入,当 IFRAME 的位置或大小发生变化时,它必须重新加载。这是在 Firefox 中完成的,但是当 IFRAME 的位置或大小发生变化时,IE 不会重新加载 IFRAME。

That's because you are using an IFRAME for embedding, IFRAME must reload when its position or size changes. This is done in Firefox, However IE doesn't reload the IFRAME when its position or size changes.

飞烟轻若梦 2024-10-15 10:17:18

Google 视频使用 Flash,当您切换到另一个选项卡时,它会从 DOM 中删除,并且当您切换回来时 Flash 必须重新加载。您也许可以为播放器创建一个自定义小部件,重新设置其父级并设置 dom 元素的显示或可见性 CSS 属性。

Google video uses flash, and when you switch to another tab,it gets removed from the DOM, and Flash will have to reload when you switch back. you might be able to create a custom widget for the player that reparents it and sets either the display or the visibility CSS attributes of the dom element.

巴黎夜雨 2024-10-15 10:17:18

在 diff 浏览器中存在此问题的 diff 行为。

对于 FF,如果您从一个选项卡切换到另一个选项卡,它将重新加载 Flash 内容。原因是,如果您从一个选项卡切换到另一个选项卡,则取消选择的选项卡“显示”属性将更改为“无”,而当您再次返回该选项卡时,“显示”属性将更改为“阻止”。这就是FF中出现这个问题的根本原因。

在 IE 中你不会遇到这个问题。

解决方案:

.templateTabItem {position: absolute !important;} //css

    TabItem item = new TabItem();
    if (!GXT.isIE && !GXT.isIE8 && !GXT.isIE9) {
        item.setHideMode(HideMode.VISIBILITY);
        item.addStyleName("templateTabItem");
    }

There are diff behaviors of this problem in diff browsers.

For FF, if you switch from one tab to another it will reload the flash content. The reason is that, if you switch from one tab to other then the deselected tab "display" property being change to "none" and when you again come back to that tab "display" property will be changed to "block". This is the root cause of this issue in FF.

In IE you wont get this issue.

Solution:

.templateTabItem {position: absolute !important;} //css

    TabItem item = new TabItem();
    if (!GXT.isIE && !GXT.isIE8 && !GXT.isIE9) {
        item.setHideMode(HideMode.VISIBILITY);
        item.addStyleName("templateTabItem");
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文