Beispiel #1
0
    async void Start()
    {
        _webRTCStreamImage   = GetComponent <RawImage>();
        _webRTCStreamTexture = new Texture2D(VIDEO_FRAME_WIDTH, VIDEO_FRAME_HEIGHT);
        var rawBytes       = _webRTCStreamTexture.GetRawTextureData();
        int rawBytesLength = rawBytes.Length;

        _textureBytes = new byte[rawBytesLength];
        _webRTCStreamImage.texture = _webRTCStreamTexture;

        _webRtcPeer.OnVideoFrame += UpdateTexture;
        await _webRtcPeer.Start();
    }
    // Start is called before the first frame update
    async void Start()
    {
        rb    = GetComponent <Rigidbody>();
        count = 0;

        SetCountText();
        winTextObject.SetActive(false);

        var texture = cam.targetTexture;

        _mainCamDupRenderTexture = texture;
        _mainCamTexture2D        = new Texture2D(texture.width, texture.height);

        await _webRtcPeer.Start();
    }