Ejemplo n.º 1
0
    public override 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;

        int s = mRtcEngine.SetVideoEncoderConfiguration(new VideoEncoderConfiguration
        {
            dimensions = new VideoDimensions()
            {
                width  = 1080,
                height = 1920
            },
            orientationMode = ORIENTATION_MODE.ORIENTATION_MODE_ADAPTIVE
        });

#if !UNITY_EDITOR
        Debug.Assert(s == 0, "RTC set video encoder configuration failed.");
#endif

        // 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.SetVideoEncoderConfiguration(new VideoEncoderConfiguration
        {
            dimensions = new VideoDimensions {
                width = 360, height = 640
            },
            frameRate       = FRAME_RATE.FRAME_RATE_FPS_24,
            bitrate         = 800,
            orientationMode = ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT
        });

        //  mRtcEngine.SetVideoQualityParameters(true);
        mRtcEngine.SetExternalVideoSource(true, false);

        mRtcEngine.SetChannelProfile(GameController.ChannelProfile);
        mRtcEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER);
        // 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);
    }
Ejemplo n.º 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();
        //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);
    }
 public abstract int SetCameraCapturerConfiguration(CameraCapturerConfiguration config);