Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Actually fix race condition that happens in production. I think.
Gabe Kangasf013a8639a94
diff --git a/main.go b/main.goindex 3dbf385666..1634c90a2b 100644--- a/main.go+++ b/main.go@@ -22,9 +22,11 @@ var stats *Statsvar usingExternalStorage = falsefunc main() {+ // logrus.SetReportCaller(true)log.StandardLogger().Printf("Owncast v%s/%s (%s)", BuildVersion, BuildType, GitCommit)checkConfig(configuration)+ resetDirectories(configuration)stats = getSavedStats()stats.Setup()@@ -42,15 +44,13 @@ func main() {go monitorVideoContent(configuration.PrivateHLSPath, configuration, storage)}+ createInitialOfflineState()go startRTMPService()- resetDirectories(configuration)startWebServer()}func startWebServer() {- // log.SetFlags(log.Lshortfile)-// websocket serverserver = NewServer("/entry")go server.Listen()diff --git a/playlistMonitor.go b/playlistMonitor.goindex 71c865dc4f..87f81b0bec 100644--- a/playlistMonitor.go+++ b/playlistMonitor.go@@ -88,6 +88,9 @@ func monitorVideoContent(pathToMonitor string, configuration Config, storage Chucase event := <-w.Event:relativePath := getRelativePathFromAbsolutePath(event.Path)+ if path.Ext(relativePath) == ".tmp" {+ continue+ }// Ignore removalsif event.Op == watcher.Remove {@@ -130,11 +133,13 @@ func monitorVideoContent(pathToMonitor string, configuration Config, storage Chu}()// Watch the hls segment storage folder recursively for changes.+ w.FilterOps(watcher.Write, watcher.Rename, watcher.Create)+if err := w.AddRecursive(pathToMonitor); err != nil {log.Fatalln(err)}- if err := w.Start(time.Millisecond * 100); err != nil {+ if err := w.Start(time.Millisecond * 200); err != nil {log.Fatalln(err)}}diff --git a/utils.go b/utils.goindex 5b484281ea..36c84ee91a 100644--- a/utils.go+++ b/utils.go@@ -74,6 +74,9 @@ func resetDirectories(configuration Config) {os.MkdirAll(path.Join(configuration.PublicHLSPath, strconv.Itoa(0)), 0777)}+}++func createInitialOfflineState() {// Provide default filesshowStreamOfflineState(configuration)if !fileExists("webroot/thumbnail.png") {