static public IVideoRecorder CreateDefaultVideoRecorder(ILogger logger, PreviewManager previewManager, VoiceInfo info, string camDevice, Action <IVideoRecorder> onReady) { #if UNITY_ANDROID && !UNITY_EDITOR var ve = new Unity.UnityAndroidVideoEncoder(logger, previewManager, info); return(new Unity.UnityAndroidVideoRecorder(ve, ve.Preview, onReady)); #elif UNITY_IOS && !UNITY_EDITOR var ve = new IOS.VideoEncoder(logger, info); return(new IOS.VideoRecorder(ve, ve.Preview, onReady)); #elif WINDOWS_UWP || (UNITY_WSA && !UNITY_EDITOR) var ve = new UWP.VideoEncoder(logger, info); return(new UWP.VideoRecorder(ve, ve.Preview, onReady)); #else IEncoderDirect <ImageInputBuf> ve; switch (info.Codec) { case Codec.VideoVP8: case Codec.VideoVP9: ve = new VPxCodec.Encoder(logger, info); break; case Codec.VideoH264: ve = new FFmpegCodec.Encoder(logger, info); break; default: throw new UnsupportedCodecException("Platform.CreateDefaultVideoEncoder", info.Codec, logger); } #if UNITY_5_3_OR_NEWER // #if UNITY return(new Unity.VideoRecorderUnity(ve, null, camDevice, info.Width, info.Height, info.FPS, onReady)); #else return(new VideoRecorder(ve, null)); #endif #endif }
static public IVideoRecorder CreateDefaultVideoRecorder(ILogger logger, PreviewManager previewManager, VoiceInfo info, string camDevice, Action <IVideoRecorder> onReady) { // native platform-specific recorders #if UNITY_ANDROID && !UNITY_EDITOR var ve = new Unity.UnityAndroidVideoEncoder(logger, previewManager, info); return(new Unity.UnityAndroidVideoRecorder(ve, ve.Preview, onReady)); #elif UNITY_IOS && !UNITY_EDITOR if (info.Codec == Codec.VideoH264) { var ve = new IOS.VideoEncoder(logger, info); return(new IOS.VideoRecorder(ve, ve.Preview, onReady)); } throw new UnsupportedCodecException("Platform.CreateDefaultVideoRecorder", info.Codec, logger); #elif WINDOWS_UWP || (UNITY_WSA && !UNITY_EDITOR) if (info.Codec == Codec.VideoH264) { var ve = new UWP.VideoEncoder(logger, info); return(new UWP.VideoRecorder(ve, ve.Preview, onReady)); } throw new UnsupportedCodecException("Platform.CreateDefaultVideoRecorder", info.Codec, logger); #else // multi-platform VideoRecorderUnity or generic VideoRecorder IEncoderDirectImage ve; switch (info.Codec) { case Codec.VideoVP8: case Codec.VideoVP9: ve = new VPxCodec.Encoder(logger, info); break; #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN case Codec.VideoH264: //ve = new FFmpegCodec.Encoder(logger, info); ve = new Windows.MFTCodec.VideoEncoder(logger, info); break; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX case Codec.VideoH264: //ve = new FFmpegCodec.Encoder(logger, info); ve = new MacOS.VideoEncoder(logger, info); break; #endif default: throw new UnsupportedCodecException("Platform.CreateDefaultVideoRecorder", info.Codec, logger); } #if UNITY_5_3_OR_NEWER // #if UNITY return(new Unity.VideoRecorderUnity(ve, null, camDevice, info.Width, info.Height, info.FPS, onReady)); #else return(new VideoRecorder(ve, null)); #endif #endif }