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 }
IDecoder createDefaultDecoder() { switch (options.outType) { case RemoteVoiceOptions.OutputType.Float: if (Info.Codec == Codec.AudioOpus) { voiceClient.transport.LogInfo(LogPrefix + ": Creating default decoder for output type = " + options.outType); return(new OpusCodec.Decoder <float>(options.output as Action <float[]>, voiceClient.transport)); } else if (Info.Codec == Codec.Raw) { voiceClient.transport.LogInfo(LogPrefix + ": Creating default decoder for output type = " + options.outType); return(new RawCodec.Decoder <float>(options.output as Action <float[]>)); } else { voiceClient.transport.LogError(LogPrefix + ": Action<float[]> output set for not audio decoder (output type = " + options.outType + ")"); return(null); } case RemoteVoiceOptions.OutputType.Short: if (Info.Codec == Codec.AudioOpus) { voiceClient.transport.LogInfo(LogPrefix + ": Creating default decoder for output type = " + options.outType); return(new OpusCodec.Decoder <short>(options.output as Action <short[]>, voiceClient.transport)); } else if (Info.Codec == Codec.Raw) { voiceClient.transport.LogInfo(LogPrefix + ": Creating default decoder for output type = " + options.outType); return(new RawCodec.Decoder <short>(options.output as Action <short[]>)); } else { voiceClient.transport.LogError(LogPrefix + ": Action<short[]> output set for not audio decoder (output type = " + options.outType + ")"); return(null); } #if PHOTON_VOICE_VIDEO_ENABLE case RemoteVoiceOptions.OutputType.Image: voiceClient.transport.LogInfo(LogPrefix + ": Creating default decoder for output type = " + options.outType); IDecoderQueuedOutputImageNative vd; switch (Info.Codec) { case Codec.VideoVP8: case Codec.VideoVP9: vd = new VPxCodec.Decoder(options.output as Action <ImageOutputBuf>, voiceClient.transport); break; case Codec.VideoH264: vd = new FFmpegCodec.Decoder(options.output as Action <ImageOutputBuf>, voiceClient.transport); break; default: voiceClient.transport.LogError(LogPrefix + ": Action<ImageOutputBuf> output set for not video decoder (output type = " + options.outType + ")"); return(null); } if (options.OutputImageFormat != ImageFormat.Undefined) { vd.OutputImageFormat = options.OutputImageFormat; } if (options.OutputImageFlip != Flip.Undefined) { vd.OutputImageFlip = options.OutputImageFlip; } return(vd); #endif case RemoteVoiceOptions.OutputType.None: default: voiceClient.transport.LogError(LogPrefix + ": Output must be set in RemoteVoiceOptions with SetOutput call (output type = " + options.outType + ")"); return(null); } }