protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Carega o layout "main" na view principal SetContentView (Resource.Layout.Main); // Pega o botão do recurso de layout e coloca um evento nele Button button = FindViewById<Button> (Resource.Id.button); vv = FindViewById<VideoView> (Resource.Id.video_view); pb = FindViewById<ProgressBar> (Resource.Id.progress_bar); MediaController mc = new MediaController(this); mp = new MediaPlayer (); pb.SetOnTouchListener (this); var uri = Android.Net.Uri.Parse ("http://3gpfind.com/vid/load/Movie%20Trailer/Predators(3gpfind.com).3gp"); vv.SetOnPreparedListener (this); vv.SetVideoURI(uri); vv.SetMediaController(mc); mc.SetMediaPlayer(vv); mc.SetAnchorView(vv); button.Click += delegate { mc.Show(); if (!ready) { holder = vv.Holder; holder.SetType (SurfaceType.PushBuffers); holder.AddCallback(this); mp.SetDataSource(this, uri); mp.SetOnPreparedListener(this); mp.Prepare(); ready = true; } mp.Start(); // vv.Start(); Toast.MakeText (this, "Video Started", ToastLength.Short).Show (); }; }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder dialog = new AlertDialog.Builder(Activity) .SetTitle(title) .SetPositiveButton("Got it", (sender, args) => { }); LayoutInflater inflater = Activity.LayoutInflater; View view = inflater.Inflate(Resource.Layout.VideoHelpPopup, null); video = view.FindViewById<VideoView>(Resource.Id.helper_video); descriptionView = view.FindViewById<TextView>(Resource.Id.helper_explanation); descriptionView.SetText(description.ToCharArray(),0, description.Length); if (!string.IsNullOrEmpty(videoAdd)) { video.Prepared += VideoPrepared; video.SetVideoURI(Uri.Parse(videoAdd)); video.Touch += VideoTouched; video.SetZOrderOnTop(true); // Removes dimming } else { LinearLayout holder = view.FindViewById<LinearLayout>(Resource.Id.helper_videoHolder); holder.Visibility = ViewStates.Gone; } dialog.SetView(view); return dialog.Create(); }
protected override void OnElementChanged (ElementChangedEventArgs<Xamarin.Forms.View> e) { base.OnElementChanged (e); //Get LayoutInflater and inflate from axml //Important note, this project utilizes a layout-land folder in the Resources folder //Android will use this folder with layout files for Landscape Orientations //This is why we don't have to worry about the layout of the play button, it doesn't exist in landscape layout file!!! var activity = Context as Activity; var viewHolder = activity.LayoutInflater.Inflate (Resource.Layout.Main, this, false); view = viewHolder; AddView (view); //Get and set Views videoView = FindViewById<VideoView> (Resource.Id.SampleVideoView); playButton = FindViewById<Android.Widget.Button> (Resource.Id.PlayVideoButton); //Give some color to the play button, but not important playButton.SetBackgroundColor (Android.Graphics.Color.Aqua); //uri for a free video var uri = Android.Net.Uri.Parse ("https://www.dropbox.com/s/hi45psyy0wq9560/PigsInAPolka1943.mp4?dl=1"); //Set the videoView with our uri, this could also be a local video on device videoView.SetVideoURI (uri); //Assign click event on our play button to play the video playButton.Click += PlayVideo; }
protected override void OnCreate (Bundle icicle) { //base.OnCreate(icicle); if (!LibsChecker.CheckVitamioLibs (this)) return; SetContentView (Resource.Layout.videobuffer); mVideoView = FindViewById<VideoView> (Resource.Id.buffer); pb = FindViewById<ProgressBar> (Resource.Id.probar); downloadRateView = FindViewById<TextView> (Resource.Id.download_rate); loadRateView = FindViewById<TextView> (Resource.Id.load_rate); if (path == "") { // Tell the user to provide a media file URL/path. Toast.MakeText (this, "Please edit VideoBuffer Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show (); return; } else { // // * Alternatively,for streaming media you can use // * mVideoView.setVideoURI(Uri.parse(URLstring)); // uri = Android.Net.Uri.Parse (path); mVideoView.SetVideoURI (uri); mVideoView.SetMediaController (new MediaController (this)); mVideoView.RequestFocus (); mVideoView.SetOnInfoListener (this); mVideoView.SetOnBufferingUpdateListener (this); mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => { e.P0.SetPlaybackSpeed(1.0f); }; } }
protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e); var crossVideoPlayerView = Element as CrossVideoPlayerView; if ((crossVideoPlayerView != null) && (e.OldElement == null)) { var metrics = Resources.DisplayMetrics; crossVideoPlayerView.HeightRequest = metrics.WidthPixels/metrics.Density/crossVideoPlayerView.VideoScale; var videoView = new VideoView(Context); var uri = Android.Net.Uri.Parse(crossVideoPlayerView.VideoSource); videoView.SetVideoURI(uri); var mediaController = new MediaController(Context); mediaController.SetAnchorView(videoView); videoView.SetMediaController(mediaController); videoView.Start(); SetNativeControl(videoView); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.upload_video_layout); context = this; Button buttonSelect = FindViewById<Button> (Resource.Id.button2); Button buttonUpload = FindViewById<Button> (Resource.Id.button); videoView = FindViewById<VideoView> (Resource.Id.videoView); videoView.SetMediaController (new Android.Widget.MediaController (this)); videoView.RequestFocus (); buttonSelect.Click += delegate { if(videoView != null) videoView.Pause(); Intent intent = new Intent (Intent.ActionPick, Android.Provider.MediaStore.Video.Media.ExternalContentUri); StartActivityForResult (intent, 0); }; buttonUpload.Click += delegate { if(videoView != null) { if(videoView.IsPlaying) { videoView.Pause(); } new UploadTask(context).Execute(new Java.Lang.Object[]{GetPathFromUri(uri)}); } }; }
protected override void OnCreate(Bundle bundle) { try { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.DetailView); string text = Intent.GetStringExtra ("Heading"); var table = TableList.FirstOrDefault (c => c.Heading == text); FindViewById<TextView> (Resource.Id.Heading).Text = table.Heading; FindViewById<TextView> (Resource.Id.SubHeading).Text = table.SubHeading; videoView = FindViewById<VideoView> (Resource.Id.SampleVideoView); play ("TransData/videoviewdemo.mp4"); } catch (Exception ex) { Console.WriteLine (ex.Message); throw ex; } // FindViewById<ImageView>(Resource.Id.branchitem_icon).SetImageURI(Android.Net.Uri.Parse(Branch.ImagePath)); // // var img = context.Resources.GetIdentifier ("index" + table.ImageResourceId.ToString (), "drawable", context.PackageName); // // view.FindViewById<ImageView>(Resource.Id.Image).SetImageResource(img); }
void Initialize () { this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394)); this.SetGravity(GravityFlags.Center); image = new RelativeLayout(context); txtTitle = new TextView (context); background = new LinearLayout (context); linearTitle = new LinearLayout (context); linearButton = new LinearLayout (context); imgPlay = new ImageButton (context); video = new VideoView (context); image.SetGravity (GravityFlags.Bottom); background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (111)); background.Orientation = Orientation.Horizontal; background.SetBackgroundColor (Color.ParseColor ("#50000000")); linearTitle.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (482), Configuration.getHeight (111)); linearTitle.Orientation = Orientation.Horizontal; linearTitle.SetGravity (GravityFlags.Center); linearButton.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (100), Configuration.getHeight (111)); linearButton.Orientation = Orientation.Horizontal; linearButton.SetGravity (GravityFlags.Center); image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394)); //image.SetGravity (GravityFlags.Bottom); video.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(582),Configuration.getHeight(394)); imgPlay.Alpha = 255.0f; imgPlay.SetBackgroundColor (Color.Transparent); txtTitle.SetTextColor (Color.ParseColor("#ffffff")); txtTitle.SetPadding (Configuration.getWidth (20), 0, 0, 0); txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40)); txtTitle.Ellipsize = Android.Text.TextUtils.TruncateAt.End; txtTitle.SetMaxLines (2); //imgPlay.SetImageBitmap (Bitmap.CreateStxtcaledBitmap (getBitmapFromAsset ("icons/"), Configuration.getWidth (83), Configuration.getHeight (83), true)); linearTitle.AddView (txtTitle); linearButton.AddView (imgPlay); background.AddView (linearTitle); background.AddView (linearButton); image.AddView (background); this.AddView (image); //this.AddView (background); }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_screen_capturer; localVideoView = (VideoView) findViewById(R.id.local_video); localMedia = LocalMedia.create(this); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.Inflate(Resource.Layout.fragment_hello_moon, container, false); mPlayButton = (Button)v.FindViewById(Resource.Id.hellomoon_playButton); mPlayButton.Click += (object sender, EventArgs e) => { mPlayer.Play(Activity); }; mStopButton = (Button)v.FindViewById(Resource.Id.hellomoon_stopButton); mStopButton.Click += (object sender, EventArgs e) => { mPlayer.Stop(); }; mPauseButton = (Button)v.FindViewById(Resource.Id.hellomoon_pauseButton); mPauseButton.Click += (object sender, EventArgs e) => { mPlayer.Pause(); }; // string fileName = "http://johnnygold.com/PigsInAPolka1943.mp4"; //Works from web string fileName = "android.resource://" + Activity.PackageName + "/" + Resource.Raw.apollo_17_strollnexus; // Now works from device. Activity.Window.SetFormat(Android.Graphics.Format.Translucent); mVideoView = (VideoView)v.FindViewById(Resource.Id.videoView); MediaController controller = new MediaController(Activity); mVideoView.SetMediaController(controller); mVideoView.RequestFocus(); Android.Net.Uri uri = Android.Net.Uri.Parse(fileName); mVideoView.SetVideoURI(uri); // mVideoView.Start(); // Not needed with MediaController // vPlayButton = (Button)v.FindViewById(Resource.Id.hellomoon_vPlayButton); // vPlayButton.Click += (object sender, EventArgs e) => { // mVideoView.Start(); // vPauseButton.Enabled = true; // }; // // vStopButton = (Button)v.FindViewById(Resource.Id.hellomoon_vStopButton); // vStopButton.Click += (object sender, EventArgs e) => { // mVideoView.StopPlayback(); // vPauseButton.Enabled = false; // mVideoView.SetVideoURI(Android.Net.Uri.Parse(fileName)); // }; // // vPauseButton = (Button)v.FindViewById(Resource.Id.hellomoon_vPauseButton); // vPauseButton.Click += (object sender, EventArgs e) => { // vPauseButton.Enabled = false; // mVideoView.Pause(); // }; return v; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.video_player); this.FindViewById<Button>(Resource.Id.MainPlay).Click += delegate { this.ButtonClick("001-Sting.m4v"); }; this.FindViewById<Button>(Resource.Id.PatchPlay).Click += delegate { this.ButtonClick("01_intro.mp4"); }; this.video = this.FindViewById<VideoView>(Resource.Id.MyVideo); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.VideoPlayer); this.FindViewById<Button>(Resource.Id.MainPlay).Click += delegate { this.ButtonClick("MetalGearSolidV.mp4"); }; this.FindViewById<Button>(Resource.Id.PatchPlay).Click += delegate { this.ButtonClick("Titanfall.mp4"); }; this.video = this.FindViewById<VideoView>(Resource.Id.MyVideo); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); this.video = new VideoView (this); SetContentView (this.video, new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)); this.path = (savedInstanceState ?? Intent.Extras).GetString ("path"); Title = System.IO.Path.GetFileName (this.path); this.video.SetVideoPath (this.path); this.video.Start(); }
private void VideoTouched(object sender, System.EventArgs e) { if (video != null) { video.StopPlayback(); video.Dispose(); video = null; } Uri videoUri = Uri.Parse(videoAdd); Intent intent = new Intent(Intent.ActionView, videoUri); intent.SetDataAndType(videoUri, "video/mp4"); Activity.StartActivity(intent); this.Dismiss(); }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_custom_capturer; localMedia = LocalMedia.create(this); capturedView = (LinearLayout) findViewById(R.id.captured_view); videoView = (VideoView) findViewById(R.id.video_view); timerView = (Chronometer) findViewById(R.id.timer_view); timerView.start(); // Once added we should see our linear layout rendered live below localVideoTrack = localMedia.addVideoTrack(true, new ViewCapturer(capturedView)); localVideoTrack.addRenderer(videoView); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Video); this.CompatMode(); // Read context nextView = Intent.Extras.GetString("nextView"); FindViewById<FloatingActionButton>(Resource.Id.btnNext).Click += BtnNext_Click; FindViewById<FloatingActionButton>(Resource.Id.btnRepeat).Click += BtnRepeat_Click; videoView = FindViewById<VideoView>(Resource.Id.videoView); var holder = videoView.Holder; holder.AddCallback(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; SetContentView(Resource.Layout.Video); this.SetSystemBarBackground (Color.Black); // Read context nextView = Intent.Extras.GetString("nextView"); videoPath = Intent.Extras.GetString("videoPath"); FindViewById<FloatingActionButton>(Resource.Id.btnNext).Click += BtnNext_Click; FindViewById<FloatingActionButton>(Resource.Id.btnRepeat).Click += BtnRepeat_Click; videoView = FindViewById<VideoView>(Resource.Id.videoView); var holder = videoView.Holder; holder.AddCallback(this); }
public Response<VideoView> AddVideo(VideoView video) { EntityFirstApp.Model.Video mappedVideo = Mapper.Map<EntityFirstApp.Model.Video>(video); var entityVideo = this.videoService.AddVideo(mappedVideo); VideoView VideoView = Mapper.Map<VideoView>(entityVideo); //// build response var response = new Response<VideoView> { Model = VideoView }; response.Messages.Add(new Message { MessageType = MessageType.Success, Value = "Success" }); return response; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); //INICIALIZAMOS NUESTRAS VISTAS PARA PODER UTILIZARLAS //BOTON GRABAR(RECORD) var recordButton = FindViewById<Button>(Resource.Id.Record); //BOTON STOP var stopButton = FindViewById<Button>(Resource.Id.Stop); //VISTA DONDE VEMOS LO QUE ESTAMOS GRABANDO _videoView = FindViewById<VideoView>(Resource.Id.SampleVideoView); recordButton.Click += delegate { //INVOCAMNOS EL METODO QUE PREPARA NUESTRA CAMARA Y MEDIA RECORD PARA COMENZAR A GRABAR if (PrepararVideoRecorder()) //COMOENZAMOS LA GRABACION DE NUESTRO VIDEO _mediaRecorder.Start(); else //LIBERAMOS LOS RECURSOS DE NUESTRO MEDIA RECORD LiberarMediaRecorder(); }; stopButton.Click += delegate { //DETEMOS NUESTRA GRABACION _mediaRecorder.Stop(); //LIBERAMOS LOS RECURSOS DE NUESTRA MEDIA RECORD LiberarMediaRecorder(); //CERRAMOS NUESTRA CAMARA PARA EVITAR QUE OTROS PROCESOS PUEDAN ACCEDER A EL. _camera.Lock(); }; }
public static void Main() { Core.Initialize(); // Initializes the GTK# app Application.Init(); using (var libvlc = new LibVLC()) using (var mediaPlayer = new MediaPlayer(libvlc)) { // Create the window in code. This could be done in glade as well, I guess... Window myWin = new Window("LibVLCSharp.GTK.Sample"); myWin.Resize(800, 450); // Creates the video view, and adds it to the window VideoView videoView = new VideoView { MediaPlayer = mediaPlayer }; myWin.Add(videoView); //Show Everything myWin.ShowAll(); //Starts playing using (var media = new Media(libvlc, "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", Media.FromType.FromLocation)) { mediaPlayer.Play(media); } myWin.DeleteEvent += (sender, args) => { mediaPlayer.Stop(); videoView.Dispose(); Application.Quit(); }; Application.Run(); } }
protected override void OnElementChanged(ElementChangedEventArgs <VideoPlayer> args) { base.OnElementChanged(args); if (args.NewElement != null) { if (Control == null) { videoView = new VideoView(Context); ARelativeLayout relativeLayout = new ARelativeLayout(Context); relativeLayout.AddView(videoView); ARelativeLayout.LayoutParams layoutParams = new ARelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); layoutParams.AddRule(LayoutRules.CenterInParent); videoView.LayoutParameters = layoutParams; videoView.Prepared += OnVideoViewPrepared; SetNativeControl(relativeLayout); } SetAreTransportControlsEnabled(); SetSource(); args.NewElement.UpdateStatus += OnUpdateStatus; args.NewElement.PlayRequested += OnPlayRequested; args.NewElement.PauseRequested += OnPauseRequested; args.NewElement.StopRequested += OnStopRequested; } if (args.OldElement != null) { args.OldElement.UpdateStatus -= OnUpdateStatus; args.OldElement.PlayRequested -= OnPlayRequested; args.OldElement.PauseRequested -= OnPauseRequested; args.OldElement.StopRequested -= OnStopRequested; } }
public async Task <ActionResult> Create(VideoView view) { if (ModelState.IsValid) { var pic = string.Empty; var folder = "~/Content/Videos"; if (view.ImageFile != null) { pic = FilesHelper.UploadPhoto(view.ImageFile, folder); pic = $"{folder}/{pic}"; } var video = this.ToVideo(view, pic); this.db.Videos.Add(video); await this.db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(view)); }
private void Initialize() { // Video view. videoView = FindViewById <VideoView>(Resource.Id.videoView); videoViewLayout = FindViewById <RelativeLayout>(Resource.Id.layout_video_view); uri = Android.Net.Uri.Parse("https://raw.githubusercontent.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4"); videoView.SetVideoURI(uri); videoView.Visibility = ViewStates.Visible; var btnStart = FindViewById <Button>(Resource.Id.btn_start); btnStart.Click += VideoStart; var btnPause = FindViewById <Button>(Resource.Id.btn_pause); btnPause.Click += VideoPause; var btnStop = FindViewById <Button>(Resource.Id.btn_stop); btnStop.Click += VideoStop; // Timeline view timelineView = FindViewById <TimelineView>(Resource.Id.timeline_video); // Range mRootLayout = FindViewById <ViewGroup>(Resource.Id.layout_range); imageViewArrowLeft = mRootLayout.FindViewById <ImageView>(Resource.Id.range_arrow_left); imageViewArrowRight = mRootLayout.FindViewById <ImageView>(Resource.Id.range_arrow_right); imageViewArrowPosition = mRootLayout.FindViewById <ImageView>(Resource.Id.position_arrow); MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); mediaMetadataRetriever.SetDataSource(uri.ToString(), new Dictionary <string, string>()); this.videoHeight = Convert.ToInt32(mediaMetadataRetriever.ExtractMetadata(MetadataKey.VideoHeight)); this.videoWidth = Convert.ToInt32(mediaMetadataRetriever.ExtractMetadata(MetadataKey.VideoWidth)); this.videoDuration = Convert.ToInt64(mediaMetadataRetriever.ExtractMetadata(MetadataKey.Duration)) * 1000; }
protected async override void OnCreate (Bundle bundle) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate (bundle); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.ClearFlags(WindowManagerFlags.ForceNotFullscreen); SetContentView (Resource.Layout.VideoViewer); videoView = FindViewById<VideoView>(Resource.Id.videoViewer); videoView.Touch += videoView_Touch; videoView.Prepared += VideoView_Prepared; m_videoPregressTimer = new System.Timers.Timer (); m_videoPregressTimer.Interval = 500; m_videoPregressTimer.Elapsed += T_Elapsed; // advertising setup AdView mAdView = (AdView) this.FindViewById(Resource.Id.adView); AdRequest adRequest = new AdRequest.Builder ().Build (); mAdView.LoadAd(adRequest); string videoID = Intent.Extras.GetString ("videoID"); try { YouTubeUri theURI = await YouTube.GetVideoUriAsync(videoID,YouTubeQuality.Quality720P); var uri = Android.Net.Uri.Parse(theURI.Uri.AbsoluteUri); videoView.SetVideoURI(uri); videoView.Start (); m_videoPregressTimer.Enabled = true; m_videoPregressTimer.Start(); m_videoSourceSet = true; } catch (Exception ex) { Console.WriteLine (ex.ToString ()); } }
public async Task <ActionResult> Edit(VideoView view) { if (ModelState.IsValid) { var pic = view.ImagePath; var folder = "~/Content/Videos"; if (view.ImageFile != null) { pic = FilesHelper.UploadPhoto(view.ImageFile, folder); pic = $"{folder}/{pic}"; } var video = this.ToVideo(view, pic); this.db.Entry(video).State = EntityState.Modified; await this.db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(view)); }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_custom_renderer; localMedia = LocalMedia.create(this); localVideoView = (VideoView) findViewById(R.id.local_video); snapshotImageView = (ImageView) findViewById(R.id.image_view); tapForSnapshotTextView = (TextView) findViewById(R.id.tap_video_snapshot); /* * Check camera permissions. Needed in Android M. */ if (!checkPermissionForCamera()) { requestPermissionForCamera(); } else { addVideo(); } }
public VideoView All(string searchKey, DateTime?fromDate, bool?isTrash, DateTime?toDate, int?pageIndex, int?pageSize) { var entitys = GetAll(); if (isTrash.HasValue) { entitys = entitys.Where(x => x.isTrash == isTrash); } if (!string.IsNullOrEmpty(searchKey)) { entitys = entitys.Where(x => x.videoTitle.ToLower().Contains(searchKey.ToLower().Trim())); } if (fromDate.HasValue) { entitys = entitys.Where(x => x.createTime.Date >= fromDate.Value.Date); } if (toDate.HasValue) { entitys = entitys.Where(x => x.createTime.Date <= toDate.Value.Date); } var totalRecord = entitys.Count(); if (pageIndex != null && pageSize != null) { entitys = entitys.Skip(((int)pageIndex - 1) * (int)pageSize); } var totalPage = 0; if (pageSize != null) { totalPage = (int)Math.Ceiling(1.0 * totalRecord / pageSize.Value); entitys = entitys.Take((int)pageSize); } var result = new VideoView { Total = totalPage, Videos = entitys }; return(result); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); // VideoViewのオブジェクトを取得して再生を開始 videoView = FindViewById <VideoView>(Resource.Id.videoview); // >> video のファイルを Resource > Drawableフォルダに入れて,fileをファイル名に書き換える<< videoView.SetVideoPath($"android.resource://" + PackageName + "/" + Resource.Drawable.file); //MediaController mediaController = new MediaController(this); //mediaController.SetAnchorView(videoView); //videoView.Visibility = ViewStates.Visible; //videoView.SetMediaController(mediaController); videoView.Touch += VideoView_Touch; videoView.Start(); textview = FindViewById <TextView>(Resource.Id.txtMsg); new System.Threading.Thread( new System.Threading.ThreadStart(delegate() { while (true) { System.Threading.Thread.Sleep(100); RunOnUiThread(() => textview.Text = videoView.CurrentPosition.ToString()); // ここでビデオの再生時間に応じた処理 } }) ).Start(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } MediaController = new MediaController(Rock.Mobile.PlatformSpecific.Android.Core.Context); RelativeLayout view = new RelativeLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); view.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); view.SetBackgroundColor(Android.Graphics.Color.Black); view.SetOnTouchListener(this); VideoPlayer = new VideoView(Activity); VideoPlayer.SetMediaController(MediaController); VideoPlayer.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); ((RelativeLayout.LayoutParams)VideoPlayer.LayoutParameters).AddRule(LayoutRules.CenterInParent); ((view as RelativeLayout)).AddView(VideoPlayer); VideoPlayer.SetOnPreparedListener(this); VideoPlayer.SetOnErrorListener(this); ProgressBar = new ProgressBar(Rock.Mobile.PlatformSpecific.Android.Core.Context); ProgressBar.Indeterminate = true; ProgressBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0)); ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((RelativeLayout.LayoutParams)ProgressBar.LayoutParameters).AddRule(LayoutRules.CenterInParent); view.AddView(ProgressBar); ProgressBar.BringToFront(); ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), delegate { TryPlayMedia( ); }); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.ClearFlags(WindowManagerFlags.ForceNotFullscreen); ActionBar.Hide(); SetContentView(Resource.Layout.video_fragment); int id = Intent.GetIntExtra(Constants.VIDEO_ID, 0); vv = (VideoView)FindViewById(Resource.Id.video); MediaController mediaController = new MediaController(this, true); vv.SetMediaController(mediaController); String uriPath = "android.resource://AlgeTiles.AlgeTiles/" + id; var uri = Android.Net.Uri.Parse(uriPath); mediaController.SetAnchorView(vv); //mediaController.Show(2000); vv.SetVideoURI(uri); vv.RequestFocus(); vv.Start(); // Create your application here }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return null; } MediaController = new MediaController( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RelativeLayout view = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); view.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent ); view.SetBackgroundColor( Android.Graphics.Color.Black ); view.SetOnTouchListener( this ); VideoPlayer = new VideoView( Activity ); VideoPlayer.SetMediaController( MediaController ); VideoPlayer.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); ( (RelativeLayout.LayoutParams)VideoPlayer.LayoutParameters ).AddRule( LayoutRules.CenterInParent ); ( ( view as RelativeLayout ) ).AddView( VideoPlayer ); VideoPlayer.SetOnPreparedListener( this ); VideoPlayer.SetOnErrorListener( this ); ProgressBar = new ProgressBar( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ProgressBar.Indeterminate = true; ProgressBar.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) ); ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (RelativeLayout.LayoutParams)ProgressBar.LayoutParameters ).AddRule( LayoutRules.CenterInParent ); view.AddView( ProgressBar ); ProgressBar.BringToFront(); ResultView = new UIResultView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), delegate { TryPlayMedia( ); } ); return view; }
protected override void OnCreate(Bundle icicle) { //base.OnCreate(icicle); if (!LibsChecker.CheckVitamioLibs(this)) { return; } SetContentView(Resource.Layout.videobuffer); mVideoView = FindViewById <VideoView> (Resource.Id.buffer); pb = FindViewById <ProgressBar> (Resource.Id.probar); downloadRateView = FindViewById <TextView> (Resource.Id.download_rate); loadRateView = FindViewById <TextView> (Resource.Id.load_rate); if (path == "") { // Tell the user to provide a media file URL/path. Toast.MakeText(this, "Please edit VideoBuffer Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show(); return; } else { // // * Alternatively,for streaming media you can use // * mVideoView.setVideoURI(Uri.parse(URLstring)); // uri = Android.Net.Uri.Parse(path); mVideoView.SetVideoURI(uri); mVideoView.SetMediaController(new MediaController(this)); mVideoView.RequestFocus(); mVideoView.SetOnInfoListener(this); mVideoView.SetOnBufferingUpdateListener(this); mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => { e.P0.SetPlaybackSpeed(1.0f); }; } }
public MainWindow() { InitializeComponent(); libVLC = new LibVLC(); // Winform var media = new Media(libVLC, "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", FromType.FromLocation); WinFormVideoView = new VideoView(); var mp = new MediaPlayer(media); WindowsFormsHost.Child = WinFormVideoView; mp.EnableMouseInput = true; WinFormVideoView.MouseClick += WinFormVideoView_MouseClick; WinFormVideoView.MediaPlayer = mp; //WPF var media1 = new Media(libVLC, "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", FromType.FromLocation); var mp1 = new MediaPlayer(media1); mp1.EnableMouseInput = true; WpfVideoView.MediaPlayer = mp1; }
private void InitComponent() { try { var media = new MediaController(this); media.Show(5000); ProgressBar = FindViewById <ProgressBar>(Resource.Id.progress_bar); ProgressBar.Visibility = ViewStates.Visible; PostVideoView = FindViewById <VideoView>(Resource.Id.videoView); PostVideoView.Completion += PostVideoViewOnCompletion; PostVideoView.SetMediaController(media); media.Visibility = ViewStates.Gone; PostVideoView.Prepared += PostVideoViewOnPrepared; //PostVideoView.CanSeekBackward(); //PostVideoView.CanSeekForward(); PostVideoView.SetAudioAttributes(new AudioAttributes.Builder().SetUsage(AudioUsageKind.Media).SetContentType(AudioContentType.Movie).Build()); if (VideoUrl.Contains("http")) { PostVideoView.SetVideoURI(Uri.Parse(VideoUrl)); } else { var file = Uri.FromFile(new File(VideoUrl)); PostVideoView.SetVideoPath(file.Path); } //TabbedMainActivity.GetInstance()?.SetOnWakeLock(); } catch (Exception e) { Console.WriteLine(e); } }
public MediaStreamer() { Core.Initialize(); InitializeComponent(); _template = new Template(new TemplateDataSet("Default template dataset", "", new TemplateDataSetItem(TemplateDataSetItemType.Text, KeyTvUrl, "", "" ))); _template.TemplateDataSet.TemplateDataSetChanged += TemplateDataSet_TemplateDataSetChanged; _template.TemplatePlaying += _template_TemplatePlaying; _template.TemplateStopped += _template_TemplateStopped; _template.TemplatePaused += _template_TemplatePaused; _template.TemplateUnload += _template_TemplateUnload; _libVLC = new LibVLC(); _mediaPlayer = new MediaPlayer(_libVLC); _videoView = new VideoView(); _videoView.MediaPlayer = _mediaPlayer; _host.Child = _videoView; VlcGrid.Children.Add(_host); }
public View VideoViewInstance() { LayoutInflater li = LayoutInflater.From(this); _advertisingView = li.Inflate(Resource.Layout.advertising_item, null); mVideoView = _advertisingView.FindViewById <VideoView>(Resource.Id.video_view); mButton = _advertisingView.FindViewById <Button>(Resource.Id.btnShop); //boton de comprar mButton.Visibility = ViewStates.Gone; mButton.Click += delegate //resetea al view invisible para los clicks { DisplayInvisibleLayout(); }; //Android.Net.Uri uri = Android.Net.Uri.Parse("android.resource://" + this.PackageName + "/raw/video.3gp"); mVideoView.SetVideoURI(Android.Net.Uri.Parse(GetVideoUrl.GetUrlBySection(_configuration.GetConfigurationSection()))); //url del video // mVideoView.RequestFocus(); return(_advertisingView); }
void SetupUserInterface() { var metrics = Resources.DisplayMetrics; view = CurrentContext.LayoutInflater.Inflate(Resource.Layout.CameraLayout, this, false); videoView = view.FindViewById <VideoView>(Resource.Id.textureView); timer = view.FindViewById <Chronometer>(Resource.Id.timerId); mainLayout = new Android.Widget.RelativeLayout(Context); Android.Widget.RelativeLayout.LayoutParams liveViewParams = new Android.Widget.RelativeLayout.LayoutParams( Android.Widget.RelativeLayout.LayoutParams.FillParent, Android.Widget.RelativeLayout.LayoutParams.FillParent); liveViewParams.Width = metrics.WidthPixels; // 80% liveViewParams.Height = (metrics.HeightPixels / 5) * 4; captureButton = view.FindViewById <Android.Widget.Button>(Resource.Id.takePhotoButton); buttonHolder = new Android.Widget.RelativeLayout(Context); captureButtonParams = new Android.Widget.RelativeLayout.LayoutParams( Android.Widget.RelativeLayout.LayoutParams.FillParent, Android.Widget.RelativeLayout.LayoutParams.FillParent); captureButtonParams.Width = metrics.WidthPixels; captureButtonParams.Height = (metrics.HeightPixels / 5) * 1; captureButtonParams.AddRule(LayoutRules.AlignParentBottom); buttonHolder.LayoutParameters = captureButtonParams; timer.Visibility = ViewStates.Invisible; Holder = videoView.Holder; Holder.AddCallback(this); Holder.SetType(SurfaceType.PushBuffers); }
public MainViewModel(VideoView videoView) { VideoView = videoView; }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_advanced_camera_capturer; localMedia = LocalMedia.create(this); videoView = (VideoView) findViewById(R.id.video_view); toggleFlashButton = (Button) findViewById(R.id.toggle_flash_button); takePictureButton = (Button) findViewById(R.id.take_picture_button); pictureImageView = (ImageView) LayoutInflater.inflate(R.layout.picture_image_view, null); pictureDialog = (new AlertDialog.Builder(this)).setView(pictureImageView).setTitle(null).setPositiveButton([email protected], new OnClickListenerAnonymousInnerClassHelper(this)) .create(); if (!checkPermissionForCamera()) { requestPermissionForCamera(); } else { addCameraVideo(); } }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.ActionBar); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ScenarioActivity); choiceLayout = FindViewById<LinearLayout>(Resource.Id.scenarioChoiceLayout); choicePrompt = FindViewById<TextView>(Resource.Id.scenarioChoicePrompt); choiceImage1 = FindViewById<ImageView>(Resource.Id.scenarioChoice1); choiceImage1.Click += ChoiceImageClicked; choiceImage2 = FindViewById<ImageView>(Resource.Id.scenarioChoice2); choiceImage2.Click += ChoiceImageClicked; breakerView = FindViewById(Resource.Id.scenarioBreaker); eventLayout = FindViewById<LinearLayout>(Resource.Id.scenarioEventLayout); eventTranscript = FindViewById<TextView>(Resource.Id.scenarioText); eventTranscript.Click += SpeakableText_Click; mainLayout = FindViewById<RelativeLayout>(Resource.Id.scenarioRecordLayout); eventImage = FindViewById<ImageView>(Resource.Id.scenarioImage); eventVideo = FindViewById<VideoView>(Resource.Id.scenarioVideo); eventPrompt = FindViewById<TextView>(Resource.Id.scenarioPrompt); eventPrompt.Click += SpeakableText_Click; mainButton = FindViewById<Button>(Resource.Id.scenarioProgressBtn); mainButton.Click += MainButtonClicked; titleLayout = FindViewById<RelativeLayout>(Resource.Id.scenarioTitleLayout); scenarioTitle = FindViewById<TextView>(Resource.Id.scenarioTitle); authorName = FindViewById<TextView>(Resource.Id.scenarioAuthor); startButton = FindViewById<Button>(Resource.Id.scenarioStartBtn); startButton.Click += delegate { titleLayout.Visibility = ViewStates.Gone; eventLayout.Visibility = ViewStates.Visible; ShowNextEvent(); }; inputHint = FindViewById<TextView>(Resource.Id.scenarioPromptHead); titleLayout.Visibility = ViewStates.Visible; eventLayout.Visibility = ViewStates.Gone; helpText = "This is a short practiceActivity which may require you to perform multiple simple tasks." + "\nOnce you have completed it, you'll be given the chance to upload your results for others to analyse and give you feedback." + "\nPress the Start button to begin!"; InitialiseData(savedInstanceState); }
public GestureListener(VideoView view) { this.view = view; }
private void LoadViews () { mVideoView = FindViewById<VideoView> (Resource.Id.videoView); mStartText = FindViewById<TextView> (Resource.Id.startText); mEndText = FindViewById<TextView> (Resource.Id.endText); mSeekbar = FindViewById<SeekBar> (Resource.Id.seekBar); mPlayPause = FindViewById<ImageView> (Resource.Id.playpause); mLoading = FindViewById<ProgressBar> (Resource.Id.progressBar); mControllers = FindViewById (Resource.Id.controllers); mContainer = FindViewById (Resource.Id.container); mVideoView.SetOnClickListener (this); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var jsonString = this.Arguments.GetString (VoteVidoeTypeFragment_KEY); var vote = Newtonsoft.Json.JsonConvert.DeserializeObject<Vote> (jsonString); View rootView = inflater.Inflate (Resource.Layout.votedescview_type02, container, false); MediaController mc = new MediaController (Activity); _videoView = rootView.FindViewById<VideoView> (Resource.Id.votedescview_type02_player); _videoView.Prepared += (sender, e) => { _videoView.Start (); }; var uri = Android.Net.Uri.Parse (vote.VideoUrl); _videoView.SetVideoURI (uri); _videoView.SetMediaController (mc); var textView = rootView.FindViewById<TextView> (Resource.Id.votedescview_type02_lbDesc); textView.Text = vote.Description; return rootView; }