protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); SetContentView(Resource.Layout.VideoRecorderLayout); imgThumbnail = FindViewById <ImageView>(Resource.Id.imgThumbnail); imgUpload = FindViewById <ImageView>(Resource.Id.imgUpload); imgSwitchCamera = FindViewById <ImageView>(Resource.Id.imgSwitchCamera); imgPlayPauseMedia = FindViewById <ImageView>(Resource.Id.imgPlayPauseMedia); txtStop = FindViewById <TextView>(Resource.Id.txtStop); txtTime = FindViewById <TextView>(Resource.Id.txtTime); framePlayPause = FindViewById <FrameLayout>(Resource.Id.framePlayPause); mainFrame = FindViewById <FrameLayout>(Resource.Id.mainFrame); imgAudio = FindViewById <ImageView>(Resource.Id.imgAudio); textureView = FindViewById <AutoFitTextureView>(Resource.Id.texture); framePlayPause.Click += FramePlayPause_Click; txtStop.Click += TxtStop_Click; imgUpload.Click += ImgUpload_Click; txtTime.Text = "00:30"; UserResponseType = (UserResponse)this.Intent.GetIntExtra("UserResponseType", 0); videoId = this.Intent.GetStringExtra("videoId"); VideoManager = new RecordResponseManager(this, UserResponseType); if (UserResponseType == UserResponse.Video) { imgAudio.Visibility = ViewStates.Gone; mainFrame.SetBackgroundResource(Resource.Color.gnt_black); VideoManager.StartBackgroundThread(); if (textureView.IsAvailable) { VideoManager.openCamera(textureView.Width, textureView.Height, VideoManager.LensFacing); } else { textureView.SurfaceTextureListener = VideoManager.surfaceTextureListener; } imgSwitchCamera.Click += ImgSwitchCamera_Click; textureView.Visibility = ViewStates.Visible; imgSwitchCamera.Visibility = ViewStates.Visible; } else { textureView.Visibility = ViewStates.Gone; imgSwitchCamera.Visibility = ViewStates.Gone; imgAudio.Visibility = ViewStates.Visible; mainFrame.SetBackgroundResource(Resource.Color.gnt_white); } var pathStr = VideoManager.GetFilePath(); }
protected override void OnResume() { base.OnResume(); if (UserResponseType == UserResponse.Video) { VideoManager.StartBackgroundThread(); if (textureView.IsAvailable) { VideoManager.openCamera(textureView.Width, textureView.Height, VideoManager.LensFacing); } else { textureView.SurfaceTextureListener = VideoManager.surfaceTextureListener; } } }
public void OnSurfaceTextureAvailable(SurfaceTexture surface_texture, int width, int height) { recordManager.openCamera(width, height, recordManager.LensFacing); }