internal void CreateSession(GoLiveCreate goLive)
        {
            var key = new StreamKey(goLive.StreamKey);

            DiscordLivestreamSession session;

            if (key.UserId == Client.User.Id)
            {
                session              = Own = new DiscordLivestreamSession(Client, key, goLive.RtcServerId, goLive.SessionId);
                session.OnConnected += s =>
                {
                    if (OnStartedLivestream != null)
                    {
                        Task.Run(() => OnStartedLivestream.Invoke(this, s));
                    }
                };
            }
            else
            {
                session              = _watching[key.UserId] = new DiscordLivestreamSession(Client, key, goLive.RtcServerId, goLive.SessionId);
                session.OnConnected += s =>
                {
                    if (OnJoinedLivestream != null)
                    {
                        Task.Run(() => OnJoinedLivestream.Invoke(this, s));
                    }
                };
            }

            session.Update(goLive);
        }
Example #2
0
 internal DiscordGoLiveSession(DiscordVoiceSession parentSession, ulong?guildId, ulong channelId, GoLiveCreate goLive) : base(parentSession.Client, guildId, channelId, goLive.SessionId)
 {
     ReceivePackets = false; // we don't have any parsers yet so we might as well not get the packets
     _rtcServerId   = goLive.RtcServerId;
     StreamKey      = goLive.StreamKey;
     Update(goLive);
     ParentSession = parentSession;
 }