媒体叠加组件

https://meta.discourse.org/t/media-overlay-plugin/60549… 之后

Discourse 媒体覆盖主题

此主题组件允许用户在浏览网站时将媒体“弹出”到浮动窗口中。即使他们导航到不同的主题,媒体也会继续播放。

它适用于任何 <iframe><video>(对 lazyYT 有一些特殊处理)。它为每个兼容的元素添加一个按钮,点击后会在右下角打开一个小弹窗。

然后您可以将其“最小化”,这样音频会在后台继续播放,或者完全关闭它。

目前视频的大小由原始嵌入决定。我想添加一个“调整大小”功能,可以是“点击并拖动”,或者简单地提供三个按钮:“小”、“中”、“大”。

目前这会遮挡编辑器……简单的解决方案是,如果您想发布帖子,只需关闭弹窗即可:wink:。

安装

主题 URL 为:

https://github.com/davidtaylorhq/discourse-media-overlay-theme

要安装,请按照以下说明操作:

29 个赞

I have fixed this with the addition of an explicit z-index, and some explicit colours. With the vincent theme it now looks like this when you mouse-over:

You may want to add some further customisation to make it match your forum’s style :slight_smile:

3 个赞

Thanks a lot! Works like a charm.

Just noticed this little :bug:

Sans%20titre

This is great! However Im not sure if its just be but while the video is playing if you:

1.change positions or minimmize and remaximize

2.pause and attempt to unpause

  1. play or pause in post, and to the opposite in the media overlay

It just freezes to the default play button and video thumbnail

Anyone else have this issue?

1 个赞

Can you clarify - is this a them or a theme component?

It is a theme component

2 个赞

OK works now -thank you

It might be better if we can scale the screen and move it to anywhere with mouse.

3 个赞

覆盖层组件是否应该支持粘贴 .mp4 文件的链接?例如在 Should audio and video tags be allowed? - #7 by codinghorror 中提到的那样?

我尝试在我的论坛上启用该功能,但当通过 mp4 链接实现视频单框显示时,视频框会完全消失。
我也用 iframe 进行了测试,结果符合预期,但 iframe 的格式调整起来更麻烦 :slight_smile:

我们刚刚安装了此功能,以便用户无需打开另一个窗口即可观看弹劾听证会,结果大受欢迎(有一条评论说:“这非常方便,太棒了。这是我体验过的最好的论坛界面。”),因此手机和平板电脑用户也希望能使用它。由于移动设备无法同时打开多个窗口,这一功能显得尤为实用。

要在平板电脑和手机上启用该功能,只需在“Common CSS”的第 64 行和第 82 行中移除 no-touch,然后在较小屏幕上调整播放器大小,例如使用以下代码:

@media (max-width: 1024px) {
    #media-overlay,
    #media-overlay iframe{
        width: 400px;
        max-height: 225px;
    }
}
@media (max-width: 768px) {
    #media-overlay,
    #media-overlay iframe{
        width: 320px;
        max-height: 180px;
    }
    #media-overlay {
        &.dock-right {
            right: 10px;
        }
        &.dock-left {
            left: 10px;
        }
    }
}
@media (max-width: 480px) {
    #media-overlay,
    #media-overlay iframe {
        width: 240px;
        max-height: 135px;
    }
    #media-overlay {
        &.dock-right {
            right: 0px;
        }
        &.dock-left {
            left: 0px;
        }
    }
}

在触控设备上,长按相当于悬停操作,可显示控制图标或媒体控件,然后点击其他位置即可再次隐藏。

我原本打算在手机上禁用此功能,但它仍然很有用,因为即使播放器折叠,用户也可以收听音频。

我假设这是一个已知限制,但 YouTube 视频在折叠时无法播放音频;此外,如果从帖子中开始播放 YouTube 视频,然后决定将其弹出,则无法在浮动窗口中播放该视频。您必须先将视频弹出(在未播放状态下),之后才能在浮动窗口中播放。

5 个赞

这应该能支持嵌入的 YouTube 视频吗?

1 个赞

如果您将 YouTube 视频作为 iFrame 发布,而不是仅仅发布链接并使用 Discourse 的 lazyYT,它似乎可以正常工作。

为了使此功能生效,您必须在网站上启用 YouTube iFrame。为此,请前往 设置 → “允许的 iFrame

5 个赞

另外,当我改变视频位置时,视频不会恢复播放。

如果你指的是 YouTube 视频,请查看我上方的帖子并使用 iframe 代码,这样就不会出现这个问题了。

我可以在您的网站上试用吗?

好的,这是一篇嵌入了 YouTube iframe 的帖子
https://unstuckpolitics.com/t/new-topic-do-not-read/242/53

1 个赞

媒体叠加层组件导致来自 imgur 等网站的视频无法在我们的论坛中显示。我们通过删除第 103 行中的 video 修复了该问题,即将 $('iframe, video, .lazyYT', $elem) 更改为 $('iframe, .lazyYT', $elem)

    function addOverlays($elem) {
      $('iframe, .lazyYT', $elem).wrap("<div class='media-overlay-eligable'></div>")

现在,imgur 视频已恢复正常运行,叠加层功能在 iframe 和 lazyYT 上依然有效。

2 个赞

对于关注此功能的用户,iOS 上的 Safari 和 Firefox 已原生支持,而 Chrome 计划在其后续版本中实现该功能。

3 个赞

他们不是计划在 Google Chrome 82 中发布吗?另外,它是否已在任何 Google Chrome 内部测试渠道中可用?

1 个赞