private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Controller   = new VideoPlayerMainController(this);
            LoadingPanel = new LoadingPanel.LoadingPanel
            {
                IsProgressVisible = false,
                ColorScheme       =
                {
                    StatusTextColor   = new SolidColorBrush(ColorConverter.FromHex("#FFffffff")),
                    BackgroundColor   = new SolidColorBrush(Colors.Black),
                    BackgroundOpacity =                                                        0,
                    LoadingColor1     = ColorConverter.FromHex("#FF777777"),
                    LoadingColor2     = ColorConverter.FromHex("#FF111111"),
                    OverlayWidth      =                                                      400,
                    OverlayHeight     = 260
                },
                Opacity = 0.5
            };
            MediaElementControl.MainUI = this;
            SliderControl.Remote       = this;
            VolumeControl.Remote       = this;
            PlayControl.Remote         = this;
            UrlControl.Remote          = this;
            ControlsPanel.Opacity      = 0.0;
            VolumeControl.SetVolume(0.5);

            JavaScriptBridge jsBridge = new JavaScriptBridge(Controller);

            HtmlPage.RegisterScriptableObject("glymaVideoPlayerBridge", jsBridge);

            Controller.Initialised();
        }
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Controller = new VideoPlayerMainController(this);
            LoadingPanel = new LoadingPanel.LoadingPanel
            {
                IsProgressVisible = false,
                ColorScheme =
                {
                    StatusTextColor = new SolidColorBrush(ColorConverter.FromHex("#FFffffff")),
                    BackgroundColor = new SolidColorBrush(Colors.Black),
                    BackgroundOpacity = 0,
                    LoadingColor1 = ColorConverter.FromHex("#FF777777"),
                    LoadingColor2 = ColorConverter.FromHex("#FF111111"),
                    OverlayWidth = 400,
                    OverlayHeight = 260
                },
                Opacity = 0.5
            };
            MediaElementControl.MainUI = this;
            SliderControl.Remote = this;
            VolumeControl.Remote = this;
            PlayControl.Remote = this;
            UrlControl.Remote = this;
            ControlsPanel.Opacity = 0.0;
            VolumeControl.SetVolume(0.5);

            JavaScriptBridge jsBridge = new JavaScriptBridge(Controller);
            HtmlPage.RegisterScriptableObject("glymaVideoPlayerBridge", jsBridge);

            Controller.Initialised();
        }
        public void ReceiveMessage(string message)
        {
            var command = Utilities.Deserialize <Command>(message);

            if (command != null)
            {
                switch (command.Name)
                {
                case "Play":
                    _mainController.Play(command);
                    break;

                case "Pause":
                    _mainController.Pause();
                    break;

                case "Stop":
                    _mainController.Stop();
                    break;

                case "Seek":
                    _mainController.Seek(command);
                    break;

                case "Mute":
                    _mainController.Mute(command);
                    break;

                case "Volume":
                    _mainController.Volume(command);
                    break;

                case "GetPosition":
                    _mainController.PositionRequest(command);
                    break;

                case "GetVolume":
                    _mainController.VolumeRequest();
                    break;

                case "GetIsMuted":
                    _mainController.IsMuted();
                    break;

                case "GetSource":
                    _mainController.SourceRequest(command);
                    break;

                case "GetSourceAndPosition":
                    _mainController.SourceAndPositionRequest(command);
                    break;

                case "GetPlayingState":
                    _mainController.StateRequest(command);
                    break;

                case "Initialised":
                    _mainController.Initialised();     //send the initialised msg again since Glyma didn't receieve it.
                    break;
                }
            }
        }