Search Unity

Question Microsoft's MixedReality-WebRTC Library: What are examples of IVideoSource type?

Discussion in 'VR' started by isaako, Oct 30, 2020.

  1. isaako

    isaako

    Joined:
    Nov 25, 2016
    Posts:
    15
    Hi Everybody,

    I am trying to do a simple webrtc connection but I receive an error about the source I am using in the StartRendering(IVideoSource) function. The Error says: error CS1503: Argument 1: cannot convert from 'Microsoft.MixedReality.WebRTC.Unity.WebcamSource' to 'Microsoft.MixedReality.WebRTC.IVideoSource' So it looks like I'm using something that is not IVideoSource type. What is the IVideoSource type? What would be an example of something that is from that type? Below is my code.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Microsoft.MixedReality.WebRTC.Unity;
    5. using System.Diagnostics;
    6.  
    7.  
    8. public class WebCam_Script : MonoBehaviour
    9. {
    10.     public GameObject LocalVid;
    11.  
    12.     // Start is called before the first frame update
    13.     void Start()
    14.     {
    15.      
    16.     }
    17.  
    18.     // Update is called once per frame
    19.     public void Update()
    20.     {
    21.         if (Input.GetKeyDown("space"))
    22.         {
    23.             print("space key was pressed");
    24.             StopWebCameo();
    25.         }
    26.     }
    27.  
    28.     public void StartWebCameo()
    29.     {
    30.         print("WebCam Started??");
    31.         StartRendeo();
    32.     }
    33.  
    34.     public void StartRendeo()
    35.     {
    36.         WebcamSource wcam = LocalVid.GetComponent<WebcamSource>();
    37.         VideoRenderer.StartRendering(wcam);
    38.     }
    39.  
    40.     public void StopWebCameo()
    41.     {
    42.         //WebcamSource wcam = GetComponent<WebcamSource>();
    43.         //VideoRenderer.StopRendering(wcam);
    44.     }
    45.  
    46.  
    47. }
    Below is the link to Microsoft's documentation. Almost at the end is the StartRendering(IVideoSource) function https://microsoft.github.io/MixedRe...ty_VideoRenderer_StartRendering_IVideoSource_