Exemplo n.º 1
0
        //------------------------------------------------------------------------------------------------------------------------
        public void serverOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
        {
            //get context
            var ctx = channel.Tags.TryGetOrDefault(typeof(ChannelContext)) as ChannelContext;

            //handle data
            if (msg.Payload is VideoDataResp)
            {
                var resp = (msg.Payload as VideoDataResp);
            }
            else if (msg.Payload is VideoData)
            {
                var resp = (msg.Payload as VideoData);
                //add bitmap to videofeed
                if (ctx.Receiving && ctx.videoInfo != null && ctx.videoInfo.IsActive)
                {
                    ctx.videoInfo.AddFrame(resp.linearBytes);
                }
            }
        }
Exemplo n.º 2
0
        //------------------------------------------------------------------------------------------------------------------------

        void clientOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
        {
            if (msg.Payload is AudioDataReq)
            {
                var req = (msg.Payload as AudioDataReq);
                if (req.aflow == AudioFlow.Start)
                {
                    try
                    {
                        audiosource.Start();
                    }
                    catch { }
                    var resp = new AudioDataResp()
                    {
                        status = StatusCode.Success
                    };
                    yclient.SendResponse(resp, msg.MessageID);
                    IsTransmitting = true;
                }
                else if (req.aflow == AudioFlow.Stop)
                {
                    IsTransmitting = false;
                    audiosource.Stop();
                    var resp = new AudioDataResp()
                    {
                        status = StatusCode.Success
                    };
                    channel.SendResponse(resp, msg.MessageID);
                }
            }
            else if (msg.Payload is AudioAuthenticationRequest)
            {
                var resp = new AudioAuthenticationResponse()
                {
                    audiotoken = this.audiotoken
                };
                channel.SendResponse(resp, msg.MessageID);
            }
        }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------------------------------------------------

        void clientOnMessageReceived(Yodiwo.YPChannel.Channel channel, Yodiwo.YPChannel.YPMessage msg)
        {
            if (msg.Payload is VideoDataReq)
            {
                var req = (msg.Payload as VideoDataReq);
                if (req.vflow == VideoFlow.Start)
                {
                    videosource.Start();
                }
                else if (req.vflow == VideoFlow.Stop)
                {
                    videosource.Stop();
                }
            }
            else if (msg.Payload is VideoAuthenticationRequest)
            {
                var resp = new VideoAuthenticationResponse()
                {
                    videotoken = this.videotoken
                };
                channel.SendResponse(resp, msg.MessageID);
                DebugEx.TraceLog("Sening response for VideoAuthenticationResponse , token=" + this.videotoken);
            }
        }