public void OnAudioFilterRead(float[] data, int channels)
 {
     CastRemoteDisplayiOSUnityBridge.EnqueueRemoteDisplayAudioBuffer(data,
                                                                     /* dataByteSize */ data.Length * sizeof(float),
                                                                     /* numberChannels */ channels,
                                                                     /* numberFrames */ data.Length / channels);
 }
        public void SetRemoteDisplayTexture(Texture texture)
        {
            IntPtr texturePointer = texture.GetNativeTexturePtr();

            if (texturePointer == IntPtr.Zero)
            {
                Debug.LogError("Couldn't obtain native pointer for the remote display texture.");
                return;
            }
            CastRemoteDisplayiOSUnityBridge.SetRemoteDisplayTexture(texturePointer);
        }
        public void Activate()
        {
            CastRemoteDisplayiOSUnityBridge.StartScan(
                extensionManager.CastRemoteDisplayManager.CastAppId, extensionManager);

            AudioSpeakerMode audioSpeakerMode = AudioSettings.GetConfiguration().speakerMode;
            int numberChannels = 0;

            switch (audioSpeakerMode)
            {
            case AudioSpeakerMode.Mono:
                numberChannels = 1;
                break;

            case AudioSpeakerMode.Stereo:
                numberChannels = 2;
                break;

            case AudioSpeakerMode.Quad:
                numberChannels = 4;
                break;

            case AudioSpeakerMode.Surround:
                numberChannels = 5;
                break;

            case AudioSpeakerMode.Mode5point1:
                numberChannels = 6;
                break;

            case AudioSpeakerMode.Mode7point1:
                numberChannels = 7;
                break;

            default:
                Debug.LogError("Cast remote display cannot support audio configuration speakermode: " +
                               audioSpeakerMode);
                return;
            }

            // Note: Unity uses PCM float 32 interleaved audio.
            CastRemoteDisplayiOSUnityBridge.SetAudioFormat(
                CastRemoteDisplayiOSUnityBridge.AudioFormat.AVAudioPCMFormatFloat32,
                AudioSettings.GetConfiguration().sampleRate,
                numberChannels,
                /* isInterleaved */ true);
        }
 public void RenderFrame()
 {
     CastRemoteDisplayiOSUnityBridge.RenderRemoteDisplay();
 }
 public void Deactivate()
 {
     CastRemoteDisplayiOSUnityBridge.TeardownRemoteDisplay();
 }
 public void SetCastVolume(float volume)
 {
     CastRemoteDisplayiOSUnityBridge.SetCastVolume(volume);
 }
 public float GetCastVolume()
 {
     return(CastRemoteDisplayiOSUnityBridge.GetCastVolume());
 }
 public void StopRemoteDisplaySession()
 {
     CastRemoteDisplayiOSUnityBridge.StopRemoteDisplaySession();
 }
 public void SelectCastDevice(string deviceId)
 {
     CastRemoteDisplayiOSUnityBridge.SelectCastDevice(deviceId,
                                                      extensionManager.CastRemoteDisplayManager.Configuration);
 }
 public List <CastDevice> GetCastDevices(ref CastDevice connectedCastDevice)
 {
     return(CastRemoteDisplayiOSUnityBridge.GetCastDevices(ref connectedCastDevice));
 }