mirror of
https://github.com/Monibuca/plugin-record.git
synced 2025-10-06 01:07:00 +08:00
导出config
This commit is contained in:
8
flv.go
8
flv.go
@@ -13,16 +13,16 @@ type FLVRecorder struct {
|
||||
Recorder
|
||||
}
|
||||
|
||||
func (r *FLVRecorder) Start(streamPath string) (err error){
|
||||
r.Record = &recordConfig.Flv
|
||||
func (r *FLVRecorder) Start(streamPath string) (err error) {
|
||||
r.Record = &RecordPluginConfig.Flv
|
||||
r.ID = streamPath + "/flv"
|
||||
return plugin.Subscribe(streamPath, r)
|
||||
}
|
||||
|
||||
func (r *FLVRecorder) start() {
|
||||
recordConfig.recordings.Store(r.ID, r)
|
||||
RecordPluginConfig.recordings.Store(r.ID, r)
|
||||
r.PlayFLV()
|
||||
recordConfig.recordings.Delete(r.ID)
|
||||
RecordPluginConfig.recordings.Delete(r.ID)
|
||||
r.Close()
|
||||
}
|
||||
|
||||
|
2
hls.go
2
hls.go
@@ -23,7 +23,7 @@ type HLSRecorder struct {
|
||||
}
|
||||
|
||||
func (h *HLSRecorder) Start(streamPath string) error {
|
||||
h.Record = &recordConfig.Hls
|
||||
h.Record = &RecordPluginConfig.Hls
|
||||
h.ID = streamPath + "/hls"
|
||||
return plugin.Subscribe(streamPath, h)
|
||||
}
|
||||
|
4
main.go
4
main.go
@@ -21,7 +21,7 @@ type RecordConfig struct {
|
||||
recordings sync.Map
|
||||
}
|
||||
|
||||
var recordConfig = &RecordConfig{
|
||||
var RecordPluginConfig = &RecordConfig{
|
||||
Subscribe: config.Subscribe{
|
||||
SubAudio: true,
|
||||
SubVideo: true,
|
||||
@@ -48,7 +48,7 @@ var recordConfig = &RecordConfig{
|
||||
},
|
||||
}
|
||||
|
||||
var plugin = InstallPlugin(recordConfig)
|
||||
var plugin = InstallPlugin(RecordPluginConfig)
|
||||
|
||||
func (conf *RecordConfig) OnEvent(event any) {
|
||||
switch v := event.(type) {
|
||||
|
2
mp4.go
2
mp4.go
@@ -68,7 +68,7 @@ func NewMP4Recorder() *MP4Recorder {
|
||||
}
|
||||
|
||||
func (r *MP4Recorder) Start(streamPath string) (err error) {
|
||||
r.Record = &recordConfig.Mp4
|
||||
r.Record = &RecordPluginConfig.Mp4
|
||||
r.ID = streamPath + "/mp4"
|
||||
return plugin.Subscribe(streamPath, r)
|
||||
}
|
||||
|
2
raw.go
2
raw.go
@@ -15,7 +15,7 @@ type RawRecorder struct {
|
||||
}
|
||||
|
||||
func (r *RawRecorder) Start(streamPath string) error {
|
||||
r.Record = &recordConfig.Raw
|
||||
r.Record = &RecordPluginConfig.Raw
|
||||
r.ID = streamPath + "/raw"
|
||||
return plugin.Subscribe(streamPath, r)
|
||||
}
|
||||
|
@@ -16,9 +16,9 @@ type Recorder struct {
|
||||
}
|
||||
|
||||
func (r *Recorder) start() {
|
||||
recordConfig.recordings.Store(r.ID, r)
|
||||
RecordPluginConfig.recordings.Store(r.ID, r)
|
||||
r.PlayRaw()
|
||||
recordConfig.recordings.Delete(r.ID)
|
||||
RecordPluginConfig.recordings.Delete(r.ID)
|
||||
r.Close()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user