/// <summary> /// Button Clicked event handler. /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event parameters</param> private void OnClicked(object sender, ClickedEventArgs e) { Button button = sender as Button; switch (button.Text) { case "play": player.Play(); break; case "pause": player.Pause(); break; case "stop": player.Stop(); break; case "forward": player.Forward(1000); // +1 sec break; case "backward": player.Backward(1000); // -1 sec break; } }
void Initialize() { Window.Instance.BackgroundColor = Color.White; player = new VideoView() { HeightResizePolicy = ResizePolicyType.SizeRelativeToParent, WidthResizePolicy = ResizePolicyType.SizeRelativeToParent, SizeModeFactor = new Vector3(1.0f, 0.5f, 1.0f), ResourceUrl = DirectoryInfo.Resource + "sample.3gp", }; player.Play(); Window.Instance.Add(player); for (int i = 0; i < buttonNames.Length; ++i) { int buttonPosX = (int)player.SizeHeight + 50 + i * 102; Button btn = new Button { ParentOrigin = ParentOrigin.Center, Size2D = new Size2D(300, 100), Position2D = new Position2D(-150, buttonPosX), BackgroundColor = new Color("#00bfff"), TextColor = Color.White, Text = buttonNames[i], }; btn.Clicked += OnClicked; Window.Instance.Add(btn); } }
private void AddVideoView() { videoView = new VideoView(); videoView.Underlay = false; string resourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "v.mp4"; videoView.ResourceUrl = resourcePath; videoView.Looping = true; videoView.Size = new Size(300, 300); videoView.Position = new Position(100, 360); videoView.Play(); win.Add(videoView); }
/// <summary> /// Function initializes application UI. /// </summary> void Initialize() { //Save the application window instance. ApplicationWindow = Window.Instance; ApplicationWindow.BackgroundColor = Color.White; //Setup event handlers. ApplicationWindow.KeyEvent += OnKeyEvent; //Create main application view. View mainView = new View(); //Setup linear layout for components stored in main view. LinearLayout mainLayout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 10) }; mainView.Layout = mainLayout; ApplicationWindow.Add(mainView); //Create video view and play movie automatically. player = new VideoView() { HeightResizePolicy = ResizePolicyType.SizeRelativeToParent, WidthResizePolicy = ResizePolicyType.SizeRelativeToParent, SizeModeFactor = new Vector3(1.0f, 0.5f, 1.0f), ResourceUrl = DirectoryInfo.Resource + "sample.3gp", }; player.Play(); mainView.Add(player); //Create buttons and push them into the main view. for (int i = 0; i < buttonNames.Length; ++i) { Button btn = new Button { ParentOrigin = ParentOrigin.Center, Size2D = new Size2D(300, 100), TextColor = Color.White, Text = buttonNames[i], }; btn.Clicked += OnClicked; mainView.Add(btn); } }
/// <summary> /// Function initializes application UI. /// </summary> void Initialize() { //Save the application window instance. ApplicationWindow = Window.Instance; ApplicationWindow.BackgroundColor = Color.White; //Setup event handlers. ApplicationWindow.KeyEvent += OnKeyEvent; //Create main application view. View mainView = new View(); //Setup linear layout for components stored in main view. LinearLayout mainLayout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 10), Padding = new Extents(10, 10, 10, 10), }; mainView.WidthResizePolicy = ResizePolicyType.FillToParent; mainView.HeightResizePolicy = ResizePolicyType.FillToParent; mainView.Layout = mainLayout; ApplicationWindow.Add(mainView); //Create video view and play movie automatically. player = new VideoView() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, ResourceUrl = DirectoryInfo.Resource + "sample.3gp", Weight = 0.5f, }; player.Play(); mainView.Add(player); //Create button container layout. View buttonContainer = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Gainsboro, Weight = 0.5f, }; LinearLayout buttonLayout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 10), }; buttonContainer.Layout = buttonLayout; mainView.Add(buttonContainer); //Create buttons and push them into the button container. for (int i = 0; i < buttonNames.Length; ++i) { Button btn = new Button { Size2D = new Size2D(300, 100), TextColor = Color.White, Text = buttonNames[i], }; btn.Clicked += OnClicked; buttonContainer.Add(btn); } }