member profile can share media.

This commit is contained in:
Miroslav Šedivý 2021-12-09 21:48:02 +01:00
parent b653856994
commit 670e0ee17d
5 changed files with 18 additions and 6 deletions

View File

@ -62,6 +62,7 @@ func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) e
CanConnect: true,
CanWatch: true,
CanHost: true,
CanShareMedia: true,
CanAccessClipboard: true,
SendsInactiveCursor: true,
CanSeeInactiveCursors: true,

View File

@ -14,6 +14,7 @@ func New() types.MemberProvider {
CanConnect: true,
CanWatch: true,
CanHost: true,
CanShareMedia: true,
CanAccessClipboard: true,
SendsInactiveCursor: true,
CanSeeInactiveCursors: true,

View File

@ -28,6 +28,7 @@ func (provider *MemberProviderCtx) Connect() error {
CanConnect: true,
CanWatch: true,
CanHost: true,
CanShareMedia: true,
CanAccessClipboard: true,
SendsInactiveCursor: true,
CanSeeInactiveCursors: true,
@ -43,6 +44,7 @@ func (provider *MemberProviderCtx) Connect() error {
CanConnect: true,
CanWatch: true,
CanHost: true,
CanShareMedia: true,
CanAccessClipboard: true,
SendsInactiveCursor: true,
CanSeeInactiveCursors: false,

View File

@ -15,6 +15,7 @@ type MemberProfile struct {
CanConnect bool `json:"can_connect"`
CanWatch bool `json:"can_watch"`
CanHost bool `json:"can_host"`
CanShareMedia bool `json:"can_share_media"`
CanAccessClipboard bool `json:"can_access_clipboard"`
SendsInactiveCursor bool `json:"sends_inactive_cursor"`
CanSeeInactiveCursors bool `json:"can_see_inactive_cursors"`

View File

@ -157,12 +157,18 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
}
connection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
if !session.Profile().CanShareMedia {
logger.Warn().
Str("kind", track.Kind().String()).
Msgf("got track but share media is disabled for this session")
receiver.Stop()
return
}
logger.Info().
Str("stream-id", track.StreamID()).
Str("id", track.ID()).
Str("rid", track.RID()).
Str("kind", track.Kind().String()).
Str("mime", track.Codec().RTPCodecCapability.MimeType).
Uint8("payload-type", uint8(track.PayloadType())).
Msgf("received new track")
// parse codec
@ -186,7 +192,6 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
logger.Err(err).Msg("failed to start pipeline")
return
}
defer srcManager.Stop() // TODO: Ensure no new publisher took over.
// Send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval
ticker := time.NewTicker(time.Second * 3)
@ -212,7 +217,9 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
srcManager.Push(buf[:i])
}
logger.Warn().Msg("src manager stream connection died")
logger.Warn().Msg("src manager stream connection died, stopping")
srcManager.Stop()
logger.Warn().Msg("src manager stream stopped!!!!!!!!!!!!!!!")
})
connection.OnDataChannel(func(dc *webrtc.DataChannel) {