/// <summary>
    /// Create the default configuration for this CallApp instance.
    /// This can be overwritten in a subclass allowing the creation custom apps that
    /// use a slightly different configuration.
    /// </summary>
    /// <returns></returns>
    public virtual MediaConfig CreateMediaConfig()
    {
        MediaConfig mediaConfig = new MediaConfig();
        //testing echo cancellation (native only)
        bool useEchoCancellation = false;

        if (useEchoCancellation)
        {
#if !UNITY_WEBGL
            var nativeConfig = new Byn.Media.Native.NativeMediaConfig();
            nativeConfig.AudioOptions.echo_cancellation   = true;
            nativeConfig.AudioOptions.extended_filter_aec = true;
            nativeConfig.AudioOptions.delay_agnostic_aec  = true;

            mediaConfig = nativeConfig;
#endif
        }



        //use video and audio by default (the UI is toggled on by default as well it will change on click )
        mediaConfig.Audio = true;
        mediaConfig.Video = true;
//        mediaConfig.VideoDeviceName = CameraName;
//        if (mediaConfig.VideoDeviceName == "")
//            mediaConfig.VideoDeviceName = null;

        int  n         = -1;
        bool isNumeric = int.TryParse(CameraNameOrIndex, out n);

        if (isNumeric)
        {
            mediaConfig.VideoDeviceName = UnityCallFactory.Instance.GetVideoDevices()[n];
        }
        else
        {
            mediaConfig.VideoDeviceName = CameraNameOrIndex;
        }


        //keep the resolution low.
        //This helps avoiding problems with very weak CPU's and very high resolution cameras
        //(apparently a problem with win10 tablets)
        mediaConfig.MinWidth       = 160;
        mediaConfig.MinHeight      = 120;
        mediaConfig.MaxWidth       = 1920;
        mediaConfig.MaxHeight      = 1080;
        mediaConfig.IdealWidth     = 640;
        mediaConfig.IdealHeight    = 480;
        mediaConfig.IdealFrameRate = 30;
        return(mediaConfig);
    }
Пример #2
0
    /// <summary>
    /// Create the default configuration for this CallApp instance.
    /// This can be overwritten in a subclass allowing the creation custom apps that
    /// use a slightly different configuration.
    /// </summary>
    /// <returns></returns>
    public virtual MediaConfig CreateMediaConfig()
    {
        MediaConfig mediaConfig = new MediaConfig();
        //testing echo cancellation (native only)
        bool useEchoCancellation = false;

        if (useEchoCancellation)
        {
#if !UNITY_WEBGL
            var nativeConfig = new Byn.Media.Native.NativeMediaConfig();
            nativeConfig.AudioOptions.echo_cancellation   = true;
            nativeConfig.AudioOptions.extended_filter_aec = true;
            nativeConfig.AudioOptions.delay_agnostic_aec  = true;

            mediaConfig = nativeConfig;
#endif
        }



        //use video and audio by default (the UI is toggled on by default as well it will change on click )
        mediaConfig.Audio           = true;
        mediaConfig.Video           = true;
        mediaConfig.VideoDeviceName = null;

        //This format is the only reliable format that works on all
        //platforms currently.
        mediaConfig.Format = FramePixelFormat.ABGR;

        mediaConfig.MinWidth  = 160;
        mediaConfig.MinHeight = 120;
        //Larger resolutions are possible in theory but
        //allowing users to set this too high is risky.
        //A lot of devices do have great cameras but not
        //so great CPU's which might be unable to
        //encode fast enough.
        mediaConfig.MaxWidth  = 1920;
        mediaConfig.MaxHeight = 1080;

        //will be overwritten by UI in normal use
        mediaConfig.IdealWidth     = 160;
        mediaConfig.IdealHeight    = 120;
        mediaConfig.IdealFrameRate = 30;
        return(mediaConfig);
    }
Пример #3
0
    /// <summary>
    /// Create the default configuration for this CallApp instance.
    /// This can be overwritten in a subclass allowing the creation custom apps that
    /// use a slightly different configuration.
    /// </summary>
    /// <returns></returns>
    public virtual MediaConfig CreateMediaConfig()
    {
        MediaConfig mediaConfig = new MediaConfig();
        //testing echo cancellation (native only)
        bool useEchoCancellation = false;

        if (useEchoCancellation)
        {
#if !UNITY_WEBGL
            var nativeConfig = new Byn.Media.Native.NativeMediaConfig();
            nativeConfig.AudioOptions.echo_cancellation   = true;
            nativeConfig.AudioOptions.extended_filter_aec = true;
            nativeConfig.AudioOptions.delay_agnostic_aec  = true;

            mediaConfig = nativeConfig;
#endif
        }



        //use video and audio by default (the UI is toggled on by default as well it will change on click )
        mediaConfig.Audio           = true;
        mediaConfig.Video           = true;
        mediaConfig.VideoDeviceName = null;

        //keep the resolution low.
        //This helps avoiding problems with very weak CPU's and very high resolution cameras
        //(apparently a problem with win10 tablets)
        mediaConfig.MinWidth       = 160;
        mediaConfig.MinHeight      = 120;
        mediaConfig.MaxWidth       = 1920;
        mediaConfig.MaxHeight      = 1080;
        mediaConfig.IdealWidth     = 160;
        mediaConfig.IdealHeight    = 120;
        mediaConfig.IdealFrameRate = 30;
        return(mediaConfig);
    }