public VideoPlayerVM(Grid container, VM vm, Rect AreaForPlacementInContainer) { Container = container; Body = new VideoPlayerView(); Body.DataContext = this; VM = vm; container.Children.Add(Body); Body.DragDropSwitchOn(Container, Body.Dragger); Body.ResizeSwitchOn(Container); Body.HorizontalAlignment = HorizontalAlignment.Left; Body.VerticalAlignment = VerticalAlignment.Top; Replace(AreaForPlacementInContainer); Body.UpFocus += UpFocusX; Body.OnSyncLeaderSet += Body_OnSyncLeaderSet; IsSyncronizeLeader = false; SyncronizationShiftVM = new SyncronizationShiftVM(this) { ShiftMaxTime = TimeSpan.FromSeconds(10) }; Body.subtitleProcessor = new SubtitleProcessor(); PlayerPanelVM = new PlayerPanelVM(Body, this); Settings.SettingsChanged += Settings_SettingsChanged; Body.SizeChanged += (s, e) => { UpdateVLCInnerPosition(); }; Body.VLC.OnVolumeChanged += (d, e) => { OnPropertyChanged("Volume"); }; Body.VLC.VideoMMM.SelectablePictureBox1.MouseDown += SelectablePictureBox1_MouseDown; }
void VideoStartup(StreamInfoArgs args) //, string profToken) { { vidBuff = new VideoBuffer((int)args.sourceResolution.Width, (int)args.sourceResolution.Height); VideoPlayerView playview = new VideoPlayerView(); disposables.Add(playview); player.Child = playview; playview.Init(new VideoPlayerView.Model( streamSetup: args.streamSetup, mediaUri: new MediaUri() { uri = args.streamUri }, encoderResolution: new VideoResolution() { height = (int)args.sourceResolution.Height, width = (int)args.sourceResolution.Width }, isUriEnabled: false, metadataReceiver: null )); }
public void PlayVideo(object param) { var videoPlayer = new VideoPlayerView(); ((VideoPlayerViewModel)videoPlayer.DataContext).Filename = param as string; videoPlayer.ShowDialog(); }
public PlayerPanelVM(VideoPlayerView body, VideoPlayerVM videoPlayerVM) { Body = body; VideoPlayerVM = videoPlayerVM; PanelBody = Body.PlayerPanelViewer; SubscriptedToEventsInPlayerDepPropChanges(); }
/** * 初始化加载动画 */ private void InitAnimation() { try { if (mVideoPrepareLayout == null) { mPlayerView = FindViewById <VideoPlayerView>(Resource.Id.playerView); mBufferingIndicator = FindViewById <View>(Resource.Id.buffering_indicator); mVideoPrepareLayout = FindViewById <RelativeLayout>(Resource.Id.video_start); mAnimImageView = FindViewById <ImageView>(Resource.Id.bili_anim); mPrepareText = FindViewById <TextView>(Resource.Id.video_start_info); } mVideoPrepareLayout.Visibility = ViewStates.Visible;// .SetVisibility(View.VISIBLE); startText = startText + "【完成】\n解析视频地址..."; mPrepareText.SetText(startText, BufferType.Normal); mLoadingAnim = (AnimationDrawable)mAnimImageView.Background;// GetBackground(); mLoadingAnim.Start(); } catch (Java.Lang.Exception e) { Log.Error(TAG, "InitAnimation--" + e.ToString()); } }
public NoMediaController() { // this demo has no build in controller. create your only controller player = new VideoPlayerView { // location in Assets folder. file marked as Asset, NOT Resource FileSource = "sample.mp4", }; // this works for android player.HeightRequest = 300; player.VideoPlayer.UseBuiltInMediaPlayer = false; // autoplay video player.VideoPlayer.AutoPlay = true; this.Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Children = { player } }; }
public override void initViews(Bundle savedInstanceState) { mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); mCollapsingToolbarLayout = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar); mVideoPreview = FindViewById <ImageView>(Resource.Id.video_preview); mSlidingTabLayout = FindViewById <SlidingTabLayout>(Resource.Id.tab_layout); mViewPager = FindViewById <ViewPager>(Resource.Id.view_pager); mFAB = FindViewById <FloatingActionButton>(Resource.Id.fab); mAppBarLayout = FindViewById <AppBarLayout>(Resource.Id.app_bar_layout); mTvPlayer = FindViewById <TextView>(Resource.Id.tv_player); mAvText = FindViewById <TextView>(Resource.Id.tv_av); mPlayerView = FindViewById <VideoPlayerView>(Resource.Id.video_view); mBufferingIndicator = FindViewById <View>(Resource.Id.buffering_indicator); Intent intent = this.Intent;// getIntent(); if (intent != null) { av = intent.GetIntExtra(ConstantUtil.EXTRA_AV, -1); imgUrl = intent.GetStringExtra(ConstantUtil.EXTRA_IMG_URL); } InitMediaPlayer(); LoadData(); mFAB.Clickable = false;// setClickable(false); Color stateColor = new Color(Resource.Color.gray_20); mFAB.BackgroundTintList = ColorStateList.ValueOf(stateColor); // SetBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.gray_20))); mFAB.TranslationY = -Resources.GetDimension(Resource.Dimension.floating_action_button_size_half); // SetTranslationY(-getResources().getDimension(R.dimen.floating_action_button_size_half)); //var mFAB_OnClick = new OnClickListener(this); mFAB.Click += delegate { Intent mIntent = new Intent(this, typeof(VideoPlayerActivity)); mIntent.PutExtra(ConstantUtil.EXTRA_CID, 1);//.getAid()); mIntent.PutExtra(ConstantUtil.EXTRA_TITLE, "From Test"); //mIntent.PutExtra(ConstantUtil.EXTRA_CID, v_detail.mVideoDetailsInfo.getData().getPages()[0].getCid());//.getAid()); //mIntent.PutExtra(ConstantUtil.EXTRA_TITLE, v_detail.mVideoDetailsInfo.getData().getTitle()); StartActivity(mIntent); };// SetOnClickListener(mFAB_OnClick); mAppBarLayout.AddOnOffsetChangedListener(this); //mAppBarLayout.OffsetChanged += delegate { // new OnOffsetChangedListener(this); //}; var mAppBar_OffsetChanged = new OnOffsetChangedListener(this); mAppBarLayout.AddOnOffsetChangedListener(mAppBar_OffsetChanged); //mTvPlayer.Click += delegate //{ // mAppBar_OffsetChanged.mCurrentState = AppBarStateChangeEvent.State.EXPANDED; // mTvPlayer.Visibility = ViewStates.Gone;// .setVisibility(View.GONE); // mAvText.Visibility = ViewStates.Visible;// .setVisibility(View.VISIBLE); // mToolbar.SetContentInsetsRelative(DisplayUtil.dp2px(BaseContext, 15), 0); //}; }
internal void PlayIntro() { VideoPlayerView.Source = VideoSource.FromResource("AvanadeStudioIntro.mp4"); VideoPlayerView.Play(); this.ForceLayout(); VideoPlayerView.VideoEnded += VideoPlayerView_IntroVideoEnded; }
private void VideoPlayerView_IntroVideoEnded(object sender, EventArgs e) { VideoPlayerView.VideoEnded -= VideoPlayerView_IntroVideoEnded; VideoPlayerView.Source = VideoSource.FromUri(Source); VideoPlayerView.Play(); this.ForceLayout(); VideoPlayerView.VideoEnded += VideoPlayerView_VideoEnded; }
public iOSVideoPlayer() { // this demo has no build in controller. create your only controller player = new VideoPlayerView { // location in Assets folder. file marked as Asset, NOT Resource FileSource = "sample.m4v", }; player.HeightRequest = 200; player.VideoPlayer.UseBuiltInMediaPlayer = false; // autoplay video player.VideoPlayer.AutoPlay = true; this.Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Children = { // can attach buttons to play and stop // hook into the player.VideoPlayer methods; new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Button { Text = "Restart", Command = new Command(() =>{ this.player.VideoPlayer.Seek = 0; }) }, new Button { Text = "Stop", Command = new Command(() =>{ this.player.VideoPlayer.Stop(); }) }, new Button { Text = "Play", Command = new Command(() =>{ this.player.VideoPlayer.Play(); }) }, } }, player } }; }
private void Reset() { if (IsPopupVideo) { if (_videoWindow == null) { _videoWindow = transform.GetComponentInChildren <VideoWindow>(); } if (_player == null) { _player = FindObjectOfType <VideoPlayerView>(); } _videoWindow.Hide(); _videoShown = false; } }
void VideoStartup(StreamInfoArgs args) //, string profToken) { { vidBuff = new VideoBuffer((int)args.sourceResolution.Width, (int)args.sourceResolution.Height); //var playerAct = container.Resolve<IVideoPlayerActivity>(); ////profileToken: profToken, //var model = new VideoPlayerActivityModel( // showStreamUrl: false, // streamSetup: new StreamSetup() { // Stream = StreamType.RTPUnicast, // Transport = new Transport() { // Protocol = AppDefaults.visualSettings.Transport_Type, // Tunnel = null // } // } //); //disposables.Add( // container.RunChildActivity(player, model, (c, m) => playerAct.Run(c, m)) //); VideoPlayerView playview = new VideoPlayerView(); disposables.Add(playview); player.Child = playview; playview.Init(new VideoPlayerView.Model( streamSetup: args.streamSetup, mediaUri: new MediaUri() { uri = args.streamUri }, encoderResolution: new VideoResolution() { height = (int)args.sourceResolution.Height, width = (int)args.sourceResolution.Width }, isUriEnabled: false, metadataReceiver: null )); }
private void Setup() { if (IsPopupVideo) { if (_videoWindow == null) { _videoWindow = transform.GetComponentInChildren <VideoWindow>(); } if (_player == null) { _player = FindObjectOfType <VideoPlayerView>(); } _player.OnStop += Reset; _player.OnEnd += Reset; _videoWindow.Hide(); } Reset(); SetName(Names); }
private void OpenHiddenView() { VideoPlayerView.Stop(); AnimateHiddenViewUp(); }
public AndroidVideoPlayer() { player = new VideoPlayerView(); this.ToolbarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Controller", Command = new Command(() => { this.player.VideoPlayer.AddVideoController = !this.player.VideoPlayer.AddVideoController; }) }); this.ToolbarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Full Screen", Command = new Command(() => { // resize the Content for full screen mode this.player.VideoPlayer.FullScreen = !this.player.VideoPlayer.FullScreen; if (this.player.VideoPlayer.FullScreen) { this.player.HeightRequest = -1; this.Content.VerticalOptions = LayoutOptions.FillAndExpand; player.VideoPlayer.FullScreen = true; } else { this.player.HeightRequest = 200; this.Content.VerticalOptions = LayoutOptions.StartAndExpand; player.VideoPlayer.FullScreen = false; } }) }); this.ToolbarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Play", Command = new Command(() => { this.player.VideoPlayer.PlayerAction = VideoSamples.Library.VideoState.PLAY; }) }); this.ToolbarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Stop", Command = new Command(() => { this.player.VideoPlayer.PlayerAction = VideoSamples.Library.VideoState.STOP; }) }); this.ToolbarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Pause", Command = new Command(() => { this.player.VideoPlayer.PlayerAction = VideoSamples.Library.VideoState.PAUSE; }) }); this.ToolbarItems.Add(new ToolbarItem { Order = ToolbarItemOrder.Secondary, Text = "Restart", Command = new Command(() => { this.player.VideoPlayer.PlayerAction = VideoSamples.Library.VideoState.RESTART; }) }); // heightRequest must be set it not full screen player.HeightRequest = 200; player.VideoPlayer.AddVideoController = false; // location in Assets folder. file marked as Asset, NOT Resource player.VideoPlayer.FileSource = "sample"; // autoplay video //player.VideoPlayer.AutoPlay = true; this.Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Children = { player } }; }
public AndroidMediaController() { player = new VideoPlayerView { // Android/Resource/raw folder //FileSource = "sample", // http FileSource = "http://techslides.com/demos/sample-videos/small.mp4" }; player.HeightRequest = 300; player.VideoPlayer.UseBuiltInMediaPlayer = true; // autoplay video // player.VideoPlayer.AutoPlay = true; player.VideoPlayer.OnBufferUpdate += (int percent) => { System.Diagnostics.Debug.WriteLine("buffer update: " + percent); }; player.VideoPlayer.OnChange += (option) => { System.Diagnostics.Debug.WriteLine(option.ToString()); }; player.VideoPlayer.OnError += (msg) => { System.Diagnostics.Debug.WriteLine("Error: " + msg); }; player.VideoPlayer.OnStateChanged += (evt) => { System.Diagnostics.Debug.WriteLine("state: " + evt); }; this.Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Children = { // can attach buttons to play and stop // hook into the player.VideoPlayer methods; new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Button { Text = "Restart", Command = new Command(() =>{ this.player.VideoPlayer.Seek = 0; }) }, new Button { Text = "Stop", Command = new Command(() =>{ this.player.VideoPlayer.Stop(); }) }, new Button { Text = "Play", Command = new Command(() =>{ this.player.VideoPlayer.Play(); }) }, } }, player } }; }
public iOSVideoPlayer() { this.ToolbarItems.Add(new ToolbarItem { Text = "Actions", Command = new Command(async() => { var result = await DisplayActionSheet("Select", "Cancel", null, "Full UIScreen", "Full Screen", "Fit Screen", "Restart", "Play", "Stop", "Resize", "Pause", "StatusBar Hide"); if (result == "Full UIScreen") { // this uiscreen.MainScreen.Bounds this.player.VideoPlayer.ContentHeight = -1; this.player.VideoPlayer.ContentWidth = -1; } else if (result == "Full Screen") { // this goes to full device screen player.VideoPlayer.FullScreen = !player.VideoPlayer.FullScreen; } else if (result == "Fit Screen") { player.VideoPlayer.FitInWindow = !player.VideoPlayer.FitInWindow; } else if (result == "Restart") { this.player.VideoPlayer.Seek = 0; } else if (result == "Play") { this.player.VideoPlayer.PlayerAction = AGR.Library.VideoState.PLAY; } else if (result == "Stop") { this.player.VideoPlayer.PlayerAction = AGR.Library.VideoState.STOP; } else if (result == "Resize") { if (test == 0) { this.player.HeightRequest = 400; this.player.VideoPlayer.ContentHeight = 400; } else if (test == 1) { this.player.HeightRequest = 200; this.player.VideoPlayer.ContentHeight = 100; } else if (test == 2) { this.player.HeightRequest = 100; this.player.VideoPlayer.ContentHeight = 100; test = -1; } test++; } else if (result == "Pause") { this.player.VideoPlayer.PlayerAction = AGR.Library.VideoState.PAUSE; } else if (result == "StatusBar Hide") { this.player.VideoPlayer.ActionBarHide = !this.player.VideoPlayer.ActionBarHide; } }) }); player = new VideoPlayerView(); player.HeightRequest = 200; player.VideoPlayer.AddVideoController = true; player.VideoPlayer.FileSource = "sample.m4v"; //"http://192.168.202.78/sample.m4v"; // autoplay video player.VideoPlayer.AutoPlay = true; this.Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Spacing = 0, Padding = new Thickness(0, 0), Children = { player } }; }