예제 #1
0
 public void Join()
 {
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     myView.SetEnable(true);
     mRtcEngine.JoinChannel(ChannelName, "", 0);
 }
예제 #2
0
    public void join(string channel)
    {
        Debug.Log("calling join (channel = " + channel + ")");

        if (mRtcEngine == null)
        {
            return;
        }

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;

        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();

        // join channel
        mRtcEngine.JoinChannel(channel, null, 0);

        // Optional: if a data stream is required, here is a good place to create it
        int streamID = mRtcEngine.CreateDataStream(true, true);

        Debug.Log("initializeEngine done, data stream id = " + streamID);
    }
 /// <summary>
 ///    Preparing video/audio/channel related characteric set up
 /// </summary>
 protected virtual void PrepareToJoin()
 {
     // enable video
     mRtcEngine.EnableVideo();
     // allow camera output callback
     mRtcEngine.EnableVideoObserver();
 }
예제 #4
0
    public void join(string channel)
    {
        Debug.Log("calling join (channel = " + channel + ")");

        if (mRtcEngine == null)
        {
            return;
        }

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;



        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();

        // join channel
        mRtcEngine.JoinChannel(channel, null, 0);

        Debug.Log("initializeEngine done");
    }
예제 #5
0
    public void join(string channel)
    {
        Debug.Log("calling join (channel = " + channel + ")");

        if (mRtcEngine == null)
        {
            return;
        }

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;

        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();
        //mRtcEngine.EnableLocalVideo(false);
        CameraCapturerConfiguration config = new CameraCapturerConfiguration();

        config.preference      = CAPTURER_OUTPUT_PREFERENCE.CAPTURER_OUTPUT_PREFERENCE_AUTO;
        config.cameraDirection = CAMERA_DIRECTION.CAMERA_REAR;
        mRtcEngine.SetCameraCapturerConfiguration(config);

        mRtcEngine.SetExternalVideoSource(true, false);

        // join channel
        mRtcEngine.JoinChannel(channel, null, 0);

        // Optional: if a data stream is required, here is a good place to create it
        int streamID = mRtcEngine.CreateDataStream(true, true);

        Debug.Log("initializeEngine done, data stream id = " + streamID);
    }
 void InitEngine()
 {
     mRtcEngine = IRtcEngine.GetEngine(APP_ID);
     mRtcEngine.SetLogFile("log.txt");
     mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_LIVE_BROADCASTING);
     mRtcEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER);
     mRtcEngine.SetVideoEncoderConfiguration(new VideoEncoderConfiguration
     {
         dimensions = new VideoDimensions {
             width = 720, height = 640
         },
         frameRate = FRAME_RATE.FRAME_RATE_FPS_24
     });
     mRtcEngine.EnableAudio();
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler;
     mRtcEngine.OnLeaveChannel       += OnLeaveChannelHandler;
     mRtcEngine.OnWarning            += OnSDKWarningHandler;
     mRtcEngine.OnError                     += OnSDKErrorHandler;
     mRtcEngine.OnConnectionLost            += OnConnectionLostHandler;
     mRtcEngine.OnUserJoined                += OnUserJoinedHandler;
     mRtcEngine.OnUserOffline               += OnUserOfflineHandler;
     mRtcEngine.OnStreamPublished           += OnStreamPublishedHandler;
     mRtcEngine.OnRtmpStreamingStateChanged += OnRtmpStreamingStateChangedHandler;
     mRtcEngine.OnRtmpStreamingEvent        += OnRtmpStreamingEventHandler;
 }
예제 #7
0
        private void Button1_Click(object sender, EventArgs e)
        {
            String channel_name = textBox1.Text;

            if (channel_name.Length == 0)
            {
                MessageBox.Show("Channel name can't be empty!");
                return;
            }

            re_.EnableVideo();
            int h_wnd = panel1.Handle.ToInt32();

            re_.SetupLocalVideo(h_wnd, 2, 0, new IntPtr());

            re_.SetParameter("rtc.channel_mode", 0);

            if (checkBox2.Checked)
            {
                // local video frame raw data handler, the raw data format is YUV420
                re_.onCaptureVideoFrame = OnCaptureVideoFrameRawHandler;
                // For remote video frame raw data handler, use onRenderVideoFrameRaw.
                re_.onRenderVideoFrame = OnRenderVideoFrameRawHandler;

                // Init video frame buffer list for thread changing.
                mutexVideoFrameRawHandlerParam_ = new Mutex();
                usingVideoFrameRawHandlerParam_ = new List <VideoFrameRawHandlerParam>();
                unUseVideoFrameRawHandlerParam_ = new List <VideoFrameRawHandlerParam>();
            }

            is_client_broadcaster_ = checkBox1.Checked;
            re_.JoinChannel(channel_name, "", 0);
        }
예제 #8
0
    // load agora engine
    public void loadEngine(string appId)
    {
        // start sdk
        Debug.Log("initializeEngine");

        if (mRtcEngine != null)
        {
            Debug.Log("Engine exists. Please unload it first!");
            return;
        }

        Debug.Log("ScreenShare Activated");
        mRtcEngine = IRtcEngine.GetEngine(appId);
        // ������־����ȼ���
        mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL);
        // ������Ƶģ�顣
        mRtcEngine.EnableVideo();
        // ������Ƶ�۲�����
        mRtcEngine.EnableVideoObserver();
        // �����ⲿ��ƵԴ��
        mRtcEngine.SetExternalVideoSource(true, false);
        // �����蹲������Ļ����
        mRect = new Rect(0, 0, Screen.width, Screen.height);
        // ���� Texture��
        mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.BGRA32, false);
    }
예제 #9
0
    private void JoinChannel()
    {
        Debug.LogFormat("Joining Channel...");

        mRtcEngine.EnableVideo();
        //mRtcEngine->EnableVideo();
        mRtcEngine.EnableVideoObserver();

        //Add our callbacks to handle Agora events
        mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccess;
        mRtcEngine.OnUserJoined         += OnUserJoined;
        mRtcEngine.OnUserOffline        += OnUserLeave;
        mRtcEngine.OnLeaveChannel       += OnLeaveChannel;

        joinButton.onClick.RemoveListener(JoinChannel);
        joinButton.onClick.AddListener(LeaveChannel);
        buttonText.text = "En vivo";

        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        mRtcEngine.JoinChannel(channelName, "extra", 0);
    }
    void Start()
    {
        if (!photonView.isMine)
        {
            return;
        }


        playerVideoList = new List <GameObject>();

        // Setup Agora Engine and Callbacks.
        if (mRtcEngine != null)
        {
            IRtcEngine.Destroy();
        }

        originalChannel = channel;

        // -- These are all necessary steps to initialize the Agora engine -- //
        // Initialize Agora engine
        mRtcEngine = IRtcEngine.GetEngine(appID);

        // Setup our callbacks (there are many other Agora callbacks, however these are the calls we need).
        mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccessHandler;
        mRtcEngine.OnUserJoined         = OnUserJoinedHandler;
        mRtcEngine.OnLeaveChannel       = OnLeaveChannelHandler;
        mRtcEngine.OnUserOffline        = OnUserOfflineHandler;

        // Your video feed will not render if EnableVideo() isn't called.
        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();

        // By setting our UID to "0" the Agora Engine creates a new one and assigns it.
        mRtcEngine.JoinChannel(channel, null, 0);
    }
예제 #11
0
 public static void EnableVideo()
 {
     if (mRtcEngine != null)
     {
         mRtcEngine.EnableVideo();
         isVideo = true;
     }
 }
    void Start()
    {
        if (mRtcEngine == null)
        {
            mRtcEngine = IRtcEngine.GetEngine(appID);

            mRtcEngine.EnableVideo();
            mRtcEngine.EnableVideoObserver();
        }
    }
예제 #13
0
 void Join()
 {
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     mRtcEngine.SetExternalVideoSource(true, false);
     // myView.SetEnable(true);
     mRtcEngine.JoinChannel(ChannelName, "", 0);
     mRect = new Rect(0, 0, Screen.width, Screen.height);
     // Creates a texture of the rectangle you create.
     mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.BGRA32, false);
 }
예제 #14
0
    void InitializeAgora()
    {
        rtcEngine = IRtcEngine.GetEngine(appID);

        rtcEngine.OnUserJoined          += OnUserJoinedHandler;
        rtcEngine.OnLocalUserRegistered += OnLocalUserRegisteredHandler;
        rtcEngine.EnableVideo();
        rtcEngine.EnableVideoObserver();

        rtcEngine.JoinChannel("agora", null, 0);
    }
예제 #15
0
        public async UniTask <bool> Join(AgoraJoinParameters joinParameters, int timeoutSeconds = 30)
        {
            if (_IsJoined)
            {
                return(true);
            }

            _RtcEngine.SetChannelProfile(joinParameters.ChannelProfile);
            _RtcEngine.SetClientRole(joinParameters.ClientRoleType);

            // Audio
            _RtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_SHOWROOM);
            _RtcEngine.SetEnableSpeakerphone(true);
            _RtcEngine.SetExternalAudioSource(joinParameters.UseExternalAudioSource, joinParameters.SampleRate, joinParameters.AudioChannels);
            _RtcEngine.SetExternalAudioSink(joinParameters.UseExternalAudioSink, joinParameters.SampleRate, joinParameters.AudioChannels);

            // Video
            var config = new VideoEncoderConfiguration()
            {
                dimensions = new VideoDimensions()
                {
                    width  = joinParameters.VideoWidth,
                    height = joinParameters.VideoHeight
                },
                frameRate = joinParameters.FrameRate,
            };

            _RtcEngine.SetVideoEncoderConfiguration(config);

            _RtcEngine.SetExternalVideoSource(joinParameters.UseExternalVideoSource);

            _RtcEngine.EnableVideoObserver();
            _RtcEngine.EnableVideo();
            _VideoDeviceManager.CreateAVideoDeviceManager();

            // Join channel
            _RtcEngine.JoinChannel(joinParameters.ChannelName, "", joinParameters.UserId);
            await UniTask.WaitUntil(() => _IsJoined).TimeoutWithoutException(TimeSpan.FromSeconds(timeoutSeconds));

            return(_IsJoined);
        }
예제 #16
0
 public void EnableVideo(bool pauseVideo)
 {
     if (mRtcEngine != null)
     {
         if (!pauseVideo)
         {
             mRtcEngine.EnableVideo();
         }
         else
         {
             mRtcEngine.DisableVideo();
         }
     }
 }
예제 #17
0
 private void InitEngine()
 {
     mRtcEngine = IRtcEngine.GetEngine(APP_ID);
     mRtcEngine.SetLogFile("log.txt");
     mRtcEngine.EnableAudio();
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler;
     mRtcEngine.OnLeaveChannel       += OnLeaveChannelHandler;
     mRtcEngine.OnWarning            += OnSDKWarningHandler;
     mRtcEngine.OnError          += OnSDKErrorHandler;
     mRtcEngine.OnConnectionLost += OnConnectionLostHandler;
     mRtcEngine.OnUserJoined     += OnUserJoinedHandler;
     mRtcEngine.OnUserOffline    += OnUserOfflineHandler;
 }
예제 #18
0
    public void JoinRemoteChannel(string remoteChannelName)
    {
        if (!photonView.isMine)
        {
            return;
        }

        mRtcEngine.LeaveChannel();

        mRtcEngine.JoinChannel(remoteChannelName, null, myUID);
        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();

        channel = remoteChannelName;
    }
 void InitRtcEngine()
 {
     mRtcEngine = IRtcEngine.GetEngine(APP_ID);
     mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_HIGH_QUALITY,
                                AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_GAME_STREAMING);
     mRtcEngine.SetExternalAudioSource(true, SAMPLE_RATE, CHANNEL);
     mRtcEngine.SetLogFile("log.txt");
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler;
     mRtcEngine.OnLeaveChannel       += OnLeaveChannelHandler;
     mRtcEngine.OnWarning            += OnSDKWarningHandler;
     mRtcEngine.OnError          += OnSDKErrorHandler;
     mRtcEngine.OnConnectionLost += OnConnectionLostHandler;
 }
예제 #20
0
 void Start()
 {
     audio     = false;
     video     = false;
     rtcEngine = IRtcEngine.GetEngine(appId);
     print(rtcEngine);
     rtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess;
     rtcEngine.OnUserJoined         = OnUserJoined;
     rtcEngine.OnUserOffline        = OnUserOffline;
     rtcEngine.OnLeaveChannel       = OnLeaveChannel;
     rtcEngine.EnableVideo();
     rtcEngine.EnableVideoObserver();
     rtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL);
     print(ChannelManager.ChannelName);
     print(rtcEngine.JoinChannel(ChannelManager.ChannelName, null, 0));
 }
예제 #21
0
    public void joinChannel(string channel)
    {
        if (ReferenceEquals(RtcEngine, null))
        {
            return;
        }

        RtcEngine.OnFirstLocalVideoFrame         = onFirstLocalVideoFrame;
        RtcEngine.OnUserJoined                   = onUserJoined;
        RtcEngine.OnFirstRemoteVideoFrameDecoded = onFirstRemoteVideoFrameDecoded;
        RtcEngine.OnUserOffline                  = onUserOffline;

        RtcEngine.EnableVideo();
        RtcEngine.SetVideoProfile(VideoProfile, true);
        RtcEngine.JoinChannel(channel, MyUserID);
    }
 void InitEngine()
 {
     mRtcEngine = IRtcEngine.GetEngine(APP_ID);
     mRtcEngine.SetLogFile("log.txt");
     mRtcEngine.SetChannelProfile(CHANNEL_PROFILE.CHANNEL_PROFILE_LIVE_BROADCASTING);
     mRtcEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER);
     mRtcEngine.EnableAudio();
     mRtcEngine.EnableVideo();
     mRtcEngine.EnableVideoObserver();
     mRtcEngine.OnJoinChannelSuccess += OnJoinChannelSuccessHandler;
     mRtcEngine.OnLeaveChannel       += OnLeaveChannelHandler;
     mRtcEngine.OnWarning            += OnSDKWarningHandler;
     mRtcEngine.OnError          += OnSDKErrorHandler;
     mRtcEngine.OnConnectionLost += OnConnectionLostHandler;
     mRtcEngine.OnUserJoined     += OnUserJoinedHandler;
     mRtcEngine.OnUserOffline    += OnUserOfflineHandler;
 }
예제 #23
0
    void Start()
    {
        if (!photonView.isMine)
        {
            return;
        }


        playerVideoList = new List <GameObject>();

        // Setup Agora Engine and Callbacks.
        if (mRtcEngine != null)
        {
            IRtcEngine.Destroy();
        }

        originalChannel = channel;

        // -- These are all necessary steps to initialize the Agora engine -- //
        // Initialize Agora engine
        mRtcEngine = IRtcEngine.GetEngine(appID);

        // Setup square video profile
        VideoEncoderConfiguration config = new VideoEncoderConfiguration();

        config.dimensions.width      = 480;
        config.dimensions.height     = 480;
        config.frameRate             = FRAME_RATE.FRAME_RATE_FPS_15;
        config.bitrate               = 800;
        config.degradationPreference = DEGRADATION_PREFERENCE.MAINTAIN_QUALITY;
        mRtcEngine.SetVideoEncoderConfiguration(config);

        // Setup our callbacks (there are many other Agora callbacks, however these are the calls we need).
        mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccessHandler;
        mRtcEngine.OnUserJoined         = OnUserJoinedHandler;
        mRtcEngine.OnLeaveChannel       = OnLeaveChannelHandler;
        mRtcEngine.OnUserOffline        = OnUserOfflineHandler;

        // Your video feed will not render if EnableVideo() isn't called.
        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();

        // By setting our UID to "0" the Agora Engine creates a unique UID and returns it in the OnJoinChannelSuccess callback.
        mRtcEngine.JoinChannel(channel, null, 0);
    }
예제 #24
0
    public void joinChannel(string channelname)
    {
        Debug.Log("joining channel " + channelname);

        if (mRtcEngine == null)
        {
            Debug.Log("engine needs to be initialized");
            return;
        }
        mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = OnUserJoined;
        mRtcEngine.OnUserOffline        = OnUserOffline;


        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();
        mRtcEngine.JoinChannel(channelname, null, 0);
    }
예제 #25
0
 public void joinChannel(string channelName)
 {
     Debug.Log("Joinning Channel :" + channelName);
     if (mrtcEngine == null)
     {
         Debug.Log("Initialize Engine before joining channel");
         return;
     }
     //set callbacks
     mrtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess;
     mrtcEngine.OnUserJoined         = OnUserJoined;
     mrtcEngine.OnUserOffline        = OnUserJoined;
     //enable video
     mrtcEngine.EnableVideo();
     //enable camera output callback
     mrtcEngine.EnableVideoObserver();
     //join the channel
     mrtcEngine.JoinChannel(channelName, null, 0);
 }
예제 #26
0
 void Start()
 {
     Debug.Log("ScreenShare Activated");
     mRtcEngine = IRtcEngine.GetEngine(appId);
     // 设置日志输出等级。
     mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL);
     // 启用视频模块。
     mRtcEngine.EnableVideo();
     // 启用视频观测器。
     mRtcEngine.EnableVideoObserver();
     // 配置外部视频源。
     mRtcEngine.SetExternalVideoSource(true, false);
     // 加入频道。
     mRtcEngine.JoinChannel(channelName, null, 0);
     // 创建需共享的屏幕区域。
     mRect = new Rect(0, 0, Screen.width, Screen.height);
     // 创建 Texture。
     mTexture = new Texture2D((int)mRect.width, (int)mRect.height, TextureFormat.BGRA32, false);
 }
예제 #27
0
    private void OnEnable()
    {
        if (mRtcEngine == null)
        {
            mRtcEngine = IRtcEngine.GetEngine(appID);
        }

        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();

        if (txtChannelId == null)
        {
            txtChannelId = GameObject.Find("txtChannelId").GetComponent <InputField>();
        }

        if (btnJoin == null)
        {
            btnJoin = GameObject.Find("btnJoin").GetComponent <Button>();
        }
    }
예제 #28
0
    public void joinChannel(string channelName)
    {
        Debug.Log("joining channel");
        if (mRtcEngine == null)
        {
            Debug.Log("engine not found");
            return;
        }

        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;


        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();
        mRtcEngine.JoinChannel(channelName, null, 0);

        Debug.Log("joined");
    }
    public void joinChannel(string channelName)
    {
        Debug.Log("Joining channel:" + channelName);

        if (mRtcEngine == null)
        {
            Debug.Log("Engine needs to be initialzed before joining a channel");
            return;
        }
        //callbacks
        mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = OnUserJoined;
        mRtcEngine.OnUserOffline        = OnUserOffline;

        //functionality
        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();
        mRtcEngine.JoinChannel("Karin", null, 0);
        Debug.Log(mRtcEngine);
    }
예제 #30
0
    void startCall()
    {
        // init engine
        mRtcEngine = IRtcEngine.getEngine(mVendorKey);
        // enable log
        mRtcEngine.SetLogFilter(LOG_FILTER.DEBUG | LOG_FILTER.INFO | LOG_FILTER.WARNING | LOG_FILTER.ERROR | LOG_FILTER.CRITICAL);

        // set callbacks (optional)
        mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        mRtcEngine.OnUserJoined         = onUserJoined;
        mRtcEngine.OnUserOffline        = onUserOffline;

        // enable video
        mRtcEngine.EnableVideo();
        // allow camera output callback
        mRtcEngine.EnableVideoObserver();

        // join channel
        mRtcEngine.JoinChannel(mChannelName, null, 0);
    }