static public IVideoPlayer CreateDefaultVideoPlayer(ILogger logger, PreviewManager previewManager, VoiceInfo info) { // native platform-specific players #if UNITY_ANDROID && !UNITY_EDITOR var vd = new Unity.UnityAndroidVideoDecoder(logger, previewManager, info.Codec); return(new VideoPlayer(vd, vd.Preview, info.Width, info.Height)); #elif UNITY_IOS && !UNITY_EDITOR if (info.Codec == Codec.VideoH264) { var vd = new IOS.VideoDecoder(logger); return(new VideoPlayer(vd, vd.Preview, info.Width, info.Height)); } throw new UnsupportedCodecException("Platform.CreateDefaultVideoPlayer", info.Codec, logger); #elif WINDOWS_UWP || (UNITY_WSA && !UNITY_EDITOR) if (info.Codec == Codec.VideoH264) { var vd = new UWP.VideoDecoder(logger, info); return(new VideoPlayer(vd, vd.Preview, info.Width, info.Height)); } throw new UnsupportedCodecException("Platform.CreateDefaultVideoPlayer", info.Codec, logger); #else // multi-platform VideoPlayerUnity or generic VideoPlayer IDecoderQueuedOutputImageNative vd; switch (info.Codec) { case Codec.VideoVP8: case Codec.VideoVP9: vd = new VPxCodec.Decoder(logger); break; #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN case Codec.VideoH264: //vd = new FFmpegCodec.Decoder(logger); vd = new Windows.MFTCodec.VideoDecoder(logger, info); break; #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX case Codec.VideoH264: //vd = new FFmpegCodec.Decoder(logger); vd = new MacOS.VideoDecoder(logger, info); break; #endif default: throw new UnsupportedCodecException("Platform.CreateDefaultVideoPlayer", info.Codec, logger); } #if UNITY_5_3_OR_NEWER // #if UNITY var vp = new Unity.VideoPlayerUnity(vd); // assign Draw method copying Image to Unity texture as software decoder Output vd.Output = vp.Draw; return(vp); #else return(new VideoPlayer(vd, null, 0, 0)); #endif #endif }
static public IVideoPlayer CreateDefaultVideoPlayer(ILogger logger, PreviewManager previewManager, VoiceInfo info) { #if UNITY_ANDROID && !UNITY_EDITOR var vd = new Unity.UnityAndroidVideoDecoder(logger, previewManager, info.Codec); return(new VideoPlayer(vd, vd.Preview, info.Width, info.Height)); #elif UNITY_IOS && !UNITY_EDITOR var vd = new IOS.VideoDecoder(logger); return(new VideoPlayer(vd, vd.Preview, info.Width, info.Height)); #elif UNITY_WSA && !UNITY_EDITOR var vd = new UWP.VideoDecoder(logger, info); return(new VideoPlayer(vd, vd.Preview, info.Width, info.Height)); #else IDecoderQueuedOutputImageNative vd; switch (info.Codec) { case Codec.VideoVP8: case Codec.VideoVP9: vd = new VPxCodec.Decoder(logger); break; case Codec.VideoH264: vd = new FFmpegCodec.Decoder(logger); break; default: throw new UnsupportedCodecException("Platform.CreateDefaultVideoDecoder", info.Codec, logger); } #if UNITY_5_3_OR_NEWER // #if UNITY var vp = new Unity.VideoPlayerUnity(vd); // assign Draw method copying Image to Unity texture as software decoder Output vd.Output = vp.Draw; return(vp); #else return(new VideoPlayer(vd, null, 0, 0)); #endif #endif }