public VideoPreviewer(Context context, GlVideoView videoView) { _mediaPlayer = new MediaPlayer(); _videoView = videoView; _triangleVertices = ByteBuffer.AllocateDirect(_triangleVerticesData.Length * FLOAT_SIZE_BYTES) .Order(ByteOrder.NativeOrder()).AsFloatBuffer(); _triangleVertices.Put(_triangleVerticesData).Position(0); _textureVertices = ByteBuffer.AllocateDirect(_textureVerticesData.Length * FLOAT_SIZE_BYTES) .Order(ByteOrder.NativeOrder()).AsFloatBuffer(); _textureVertices.Put(_textureVerticesData).Position(0); Android.Opengl.Matrix.SetIdentityM(_STMatrix, 0); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); _videoView = FindViewById <GlVideoView>(Resource.Id.myVideoView); _workingDirectory = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; var movie = System.IO.Path.Combine(_workingDirectory, "cat2.mp4"); if (!System.IO.File.Exists(movie)) { CreateSampleFile(Resource.Raw.cat2, _workingDirectory, "cat2.mp4"); } _videoView.SetSource(movie); FindViewById <Button>(Resource.Id.button1).Click += (sender, e) => { _videoView.Play(); }; }