mirror of
https://github.com/owncast/owncast.git
synced 2024-11-23 13:24:33 +03:00
f81e8dcda7
* Mute the 'stream ended' clip's audio The 'stream ended' clip plays at the at the end of every stream broadcast using owncast. It currently contains audio that peaks at -7.1db. (according to ffmpeg's volumedetect audio filter) This can result in a bad experience for viewers if the stream that they were just watching had a much lower average volume, and they had turned up their speakers or headphones to compensate. In extreme cases this could theoretically cause harm to viewers and/or their equipment. As an admin running owncast, there is no way to remove this audio *except* for patching the file. Even if you do patch the file, you need to notify your viewers to clear their browser caches if they have ever seen the clip, because offline.ts has a cache-control max-age header specifying 365 days. The caching of the previous version of this clip is out of scope of this PR. This issue is discussed in more detail in #1965. Unlike my previous attempt in #3332, which removed the audio track, this PR *mutes* the audio. Specifically, I used this ffmpeg command: ``` ffmpeg -i offline.ts -filter:a "volume=0.0" output.ts ``` There are no other modifications to the clip. * Commit updated API documentation * feat(video): make compatible muted offline clip. Rename clip as a v2 so it is not cached * Fix conflict * force add new offline file --------- Co-authored-by: vivlim <vivlim@vivl.im> Co-authored-by: Owncast <owncast@owncast.online> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
89 lines
1.9 KiB
Go
Vendored
89 lines
1.9 KiB
Go
Vendored
package static
|
|
|
|
import (
|
|
"embed"
|
|
"html/template"
|
|
"io/fs"
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
//go:embed web/*
|
|
//go:embed web/_next/static
|
|
//go:embed web/_next/static/chunks/pages/*.js
|
|
//go:embed web/_next/static/*/*.js
|
|
var webFiles embed.FS
|
|
|
|
// GetWeb will return an embedded filesystem reference to the admin web app.
|
|
func GetWeb() fs.FS {
|
|
wf, err := fs.Sub(webFiles, "web")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
return wf
|
|
}
|
|
|
|
//go:embed img/emoji/*
|
|
var emojiFiles embed.FS
|
|
|
|
// GetEmoji will return the emoji files.
|
|
func GetEmoji() fs.FS {
|
|
ef, err := fs.Sub(emojiFiles, "img/emoji")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
return ef
|
|
}
|
|
|
|
// GetWebIndexTemplate will return the bot/scraper metadata template.
|
|
func GetWebIndexTemplate() (*template.Template, error) {
|
|
webFiles := GetWeb()
|
|
name := "index.html"
|
|
t, err := template.ParseFS(webFiles, name)
|
|
if err != nil {
|
|
return nil, errors.Wrap(err, "unable to open index.html template")
|
|
}
|
|
|
|
tmpl := template.Must(t, err)
|
|
return tmpl, err
|
|
}
|
|
|
|
//go:embed offline-v2.ts
|
|
var offlineVideoSegment []byte
|
|
|
|
// GetOfflineSegment will return the offline video segment data.
|
|
func GetOfflineSegment() []byte {
|
|
return getFileSystemStaticFileOrDefault("offline-v2.ts", offlineVideoSegment)
|
|
}
|
|
|
|
//go:embed img/logo.png
|
|
var logo []byte
|
|
|
|
// GetLogo will return the logo data.
|
|
func GetLogo() []byte {
|
|
return getFileSystemStaticFileOrDefault("img/logo.png", logo)
|
|
}
|
|
|
|
func getFileSystemStaticFileOrDefault(path string, defaultData []byte) []byte {
|
|
fullPath := filepath.Join("static", path)
|
|
data, err := os.ReadFile(fullPath) //nolint: gosec
|
|
if err != nil {
|
|
return defaultData
|
|
}
|
|
|
|
return data
|
|
}
|
|
|
|
//go:embed metadata.html.tmpl
|
|
var botMetadataTemplate embed.FS
|
|
|
|
// GetBotMetadataTemplate will return the bot/scraper metadata template.
|
|
func GetBotMetadataTemplate() (*template.Template, error) {
|
|
name := "metadata.html.tmpl"
|
|
t, err := template.ParseFS(botMetadataTemplate, name)
|
|
tmpl := template.Must(t, err)
|
|
return tmpl, err
|
|
}
|