refactor: onpub and onsub

This commit is contained in:
langhuihui
2024-08-27 13:00:26 +08:00
parent a214f51378
commit 2261d75ac1
24 changed files with 343 additions and 440 deletions

View File

@@ -3,12 +3,13 @@ package plugin_rtmp
import (
"context"
gpb "m7s.live/m7s/v5/pb"
"m7s.live/m7s/v5/pkg/config"
"m7s.live/m7s/v5/plugin/rtmp/pb"
rtmp "m7s.live/m7s/v5/plugin/rtmp/pkg"
)
func (r *RTMPPlugin) PushOut(ctx context.Context, req *pb.PushRequest) (res *gpb.SuccessResponse, err error) {
pusher := rtmp.NewPusher()
err = pusher.GetPushJob().Init(pusher, &r.Plugin, req.StreamPath, req.RemoteURL).WaitStarted()
err = pusher.GetPushJob().Init(pusher, &r.Plugin, req.StreamPath, config.Push{URL: req.RemoteURL}).WaitStarted()
return &gpb.SuccessResponse{}, err
}