加入是否允许空房间的配置

This commit is contained in:
langhuihui
2020-03-15 19:57:57 +08:00
parent a08538e66e
commit 00128ce20a
7 changed files with 47 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"time"
"github.com/Monibuca/engine/avformat"
"github.com/pkg/errors"
)
// Subscriber 订阅者
@@ -55,6 +56,11 @@ func (s *OutputStream) Close() {
//Play 开始订阅
func (s *OutputStream) Play(streamPath string) (err error) {
if !config.EnableWaitRoom {
if _, ok := AllRoom.Load(streamPath); !ok {
return errors.New(fmt.Sprintf("Stream not found:%s", streamPath))
}
}
AllRoom.Get(streamPath).Subscribe(s)
defer s.UnSubscribe(s)
for {