Пример #1
0
        /// Load a video with ID and optional OAuth token
        ///
        /// - Parameter videoId:        The video's XID
        ///   - accessToken: An optional oauth token. If provided it will be passed as Bearer token to the player.
        ///   - withParameters:  The dictionary of configuration parameters that are passed to the player.
        ///   - withCookiesParameters:     An optional array of HTTPCookie values that are passed to the player.
        public void Load(string videoId, string accessToken = "", IDictionary <string, string> withParameters = null, IDictionary <string, string> withCookiesParameters = null)
        {
            HasPlayerError      = false;
            this.VideoId        = videoId;
            this.WithParameters = withParameters;
            this.AccessToken    = accessToken;

            //check base url
            if (BaseUrl != null)
            {
                //Creating a new webview when doing a new call
                //or using the JS to load the video if the player is already loaded
                if (DmVideoPlayer == null)
                {
                    //init webview with cookies
                    Init(accessToken, withParameters, withCookiesParameters);
                }

                //if empty bypass
                if (WithParameters == null)
                {
                    return;
                }

                ///Creatings commands from passed Paramaters
                //COMMAND_SETPROP
                if (WithParameters.ContainsKey("jsonEnvironmentInfo"))
                {
                    QueueCommand(COMMAND_SETPROP, WithParameters["jsonEnvironmentInfo"]);
                }

                //COMMAND_LOAD_JSON
                if (WithParameters.ContainsKey("loadedJsonData"))
                {
                    var _params = new string[2];
                    _params[0] = VideoId;
                    _params[1] = WithParameters["loadedJsonData"];

                    QueueCommand(COMMAND_LOAD_JSON, _params);
                }
                else
                {
                    //CallPlayerMethod("load", VideoId);
                    QueueCommand(COMMAND_LOAD, VideoId);
                }

                //check to see if we wish to mute or not the video
                if (WithParameters.ContainsKey("mute"))
                {
                    if (WithParameters["mute"] == "true")
                    {
                        Mute();
                    }
                    else
                    {
                        Unmute();
                    }
                }
            }
        }
Пример #2
0
        public void Run()
        {
            var @default = new Default();

            // var withParameters = new WithParameters();
            var withParameters2 = new WithParameters(1);
            var withParameters3 = new WithParameters(1, 1);

            // var private = new Private();
            var private2 = Private.Create();
            var private3 = Private.Create(1);

            var privateWithNested  = new PrivateWithNested.Nested();
            var privateWithNested2 = privateWithNested.Create();

            var copy = new CopyInstance {
                Property1 = 1, Property2 = 1
            };
            var copy2 = new CopyInstance(copy);

            var parameterless = new Parameterless();

            var overloaded  = new Overloaded(1);
            var overloaded2 = new Overloaded(1, 1);

            var hasReturn = new HasReturn(1, 1);

            var @static = Static.Field2;
            var static2 = new Static(1);

            var staticClass = StaticInStaticClass.Field;

            var inherited  = new Inherited(1);
            var inherited2 = new Inherited();

            var initializeReadonly = new InitializeReadonlyWithStatic(1);

            var nestedWithStatic = new OuterWithStatic.InnerWithStatic(1);
            var innerStaticClass = OuterStaticClass.InnerStaticClass.Field;

            // var @private = new AccessModifiers();
            // var @protected = new AccessModifiers(1);
            var @internal         = new AccessModifiers(1, 1);
            var protectedInternal = new AccessModifiers(1, 1, 1);
            // var @privateProtected = new AccessModifiers(1, 1, 1, 1);
            var @public = new AccessModifiers(1, 1, 1, 1, 1);

            var canNot = new CanNot();

            CanNotBeInStaticClass.StepIn();
        }
        /// <summary>
        /// When the player is already loaded this allows to us to call on the JS methods of the player and thus allows to interact with it
        /// Load allows us to start a video without having to requery a URL
        /// </summary>
        private void Load()
        {
            if (WithParameters == null)
            {
                return;
            }

            if (WithParameters.ContainsKey("jsonEnvironmentInfo"))
            {
                InitEnvironmentInfoVariables(WithParameters["jsonEnvironmentInfo"]);
            }
            else
            {
                //set param for partners
            }


            if (WithParameters.ContainsKey("loadedJsonData"))
            {
                CallPlayerMethod("load", VideoId, WithParameters["loadedJsonData"]);
            }
            else
            {
                CallPlayerMethod("load", VideoId);
            }

            //check to see if we wish to mute or not the video
            if (WithParameters.ContainsKey("mute"))
            {
                if (WithParameters["mute"] == "true")
                {
                    Mute();
                }
                else
                {
                    Unmute();
                }
            }
        }