示例#1
0
        /// <summary>
        /// Creates new instance of MediaPlayerFactory and returns proxied interface for better version handling of
        /// nVLC and underlying libVLC SDK.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="findLibvlc"></param>
        /// <param name="useCustomStringMarshaller"></param>
        /// <returns></returns>
        /// <remarks>Experimental API which allows to safely use any nVLC version with any libVLC version starting with 1.1</remarks>
        public static IMediaPlayerFactory Create(string[] args = null, bool findLibvlc = false, bool useCustomStringMarshaller = false)
        {
            IMediaPlayerFactory factory;

            if (args == null || args.Length == 0)
            {
                factory = new MediaPlayerFactory(findLibvlc, useCustomStringMarshaller);
            }
            else
            {
                factory = new MediaPlayerFactory(args, findLibvlc, useCustomStringMarshaller);
            }

            ProxyBuilder <IMediaPlayerFactory> proxyBuilder = new ProxyBuilder <IMediaPlayerFactory>(factory);
            VersionCompatibilityVerifier       vch          = new VersionCompatibilityVerifier(factory.Version);

            proxyBuilder.RegisterAttributeHandler <MaxLibVlcVersion>(vch.HandleDeprecatedApi);
            proxyBuilder.RegisterAttributeHandler <MinimalLibVlcVersion>(vch.HandleMissingApi);

            return(proxyBuilder.GetTransparentProxy() as IMediaPlayerFactory);
        }