I'm trying to add video_player plugin to show videos in my project but the project is crashing and show this on the console
[ERROR:flutter/shell/platform/android/platform_view_android_jni_impl.cc(43)] java.lang.RuntimeException: Error during attachToGLContext (see logcat for details) E/flutter (15242): at android.graphics.SurfaceTexture.attachToGLContext(SurfaceTexture.java:286) E/flutter (15242): F/flutter (15242): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1062)] Check failed: CheckException(env). F/libc (15242): Fatal signal 6 (SIGABRT), code -6 in tid 15334 (1.raster)
this is the method which i use
VideoPlayerController _controller;
@override
void initState() {
super.initState();
super.initState();
_controller = VideoPlayerController.network(
'http://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_20mb.mp4')
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
Container(
height: 200,
child: Scaffold(
body: Center(
child: _controller.value.initialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
_controller.value.isPlaying
? _controller.pause()
: _controller.play();
});
},
child: Icon(
_controller.value.isPlaying
? Icons.pause
: Icons.play_arrow,
),
),
),),
so can anyone tell me what the wrong !!!