mirror of
https://github.com/owncast/owncast.git
synced 2024-11-29 03:29:03 +03:00
04dc0796d8
* New video transcoder * Set a smaller max muxing size + logging tweaks * No need to return an err since it wiill panic anyway * Use a default encoder preset if one is not supplied * Rename to NewTranscoder. Add comments. * Rename Bitrate to VideoBitrate. Config file changes required with this rename. * Allow overrides of segment length. Allow offline stream to live in a single segment * Append offline state video to existin HLS stream instead of overwriting because players do not like that * Make properties private as they do not need to be exported
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package core
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gabek/owncast/config"
|
|
"github.com/gabek/owncast/core/ffmpeg"
|
|
"github.com/gabek/owncast/models"
|
|
)
|
|
|
|
//GetStatus gets the status of the system
|
|
func GetStatus() models.Status {
|
|
if _stats == nil {
|
|
return models.Status{}
|
|
}
|
|
|
|
return models.Status{
|
|
Online: IsStreamConnected(),
|
|
ViewerCount: len(_stats.Clients),
|
|
OverallMaxViewerCount: _stats.OverallMaxViewerCount,
|
|
SessionMaxViewerCount: _stats.SessionMaxViewerCount,
|
|
LastDisconnectTime: _stats.LastDisconnectTime,
|
|
LastConnectTime: _stats.LastConnectTime,
|
|
}
|
|
}
|
|
|
|
//SetStreamAsConnected sets the stream as connected
|
|
func SetStreamAsConnected() {
|
|
_stats.StreamConnected = true
|
|
_stats.LastConnectTime = time.Now()
|
|
|
|
timeSinceDisconnect := time.Since(_stats.LastDisconnectTime).Minutes()
|
|
if timeSinceDisconnect > 15 {
|
|
_stats.SessionMaxViewerCount = 0
|
|
}
|
|
|
|
chunkPath := config.Config.PublicHLSPath
|
|
if usingExternalStorage {
|
|
chunkPath = config.Config.PrivateHLSPath
|
|
}
|
|
|
|
ffmpeg.StartThumbnailGenerator(chunkPath)
|
|
}
|
|
|
|
//SetStreamAsDisconnected sets the stream as disconnected
|
|
func SetStreamAsDisconnected() {
|
|
_stats.StreamConnected = false
|
|
_stats.LastDisconnectTime = time.Now()
|
|
|
|
ffmpeg.ShowStreamOfflineState()
|
|
}
|