Flutter app crashes for ANY VIDEO before it even starts playing on my Android phone
1,150
Ok, I figured out that it works when i'm not in "debug mode on my phone". I.e, if I unplug the phone from the computer, and then run the app on the phone alone, the video works. Its not perfect for me, but I wont waste time with that.
Author by
Felipe Thomé
Updated on December 26, 2022Comments
-
Felipe Thomé over 1 year
i'm trying to use this video_player plugin from flutter, but i'm not able to play any video. Not even those from their own examples, cause the app crashes when i try to play it. I've tried to use different widgets like futureBuilder but had no sucess also. I've searched alot and found something about samsung problems to run the video, but that would be absurd. Any help with be apreciated
Here's the stacktrace:
I/ACodec (18054): [] onAllocateComponent I/OMXClient(18054): Using client-side OMX mux. I/ACodec (18054): [OMX.SEC.aac.dec] Now Loaded I/ACodec (18054): codec does not support config operating rate (err -1010) I/ACodec (18054): [OMX.SEC.aac.dec] Now Loaded->Idle I/ACodec (18054): [OMX.SEC.aac.dec] Now Idle->Executing I/ACodec (18054): [OMX.SEC.aac.dec] Now Executing I/System.out(18054): (HTTPLog)-Static: isSBSettingEnabled false I/System.out(18054): (HTTPLog)-Static: isSBSettingEnabled false I/ACodec (18054): [OMX.qcom.video.decoder.avc] Now handling output port settings change D/SurfaceUtils(18054): set up nativeWindow 0xb8f94d78 for 1280x720, color 0x7fa30c04, rotation 0, usage 0x42002900 I/ACodec (18054): [OMX.qcom.video.decoder.avc] configureOutputBuffersFromNativeWindow setBufferCount : 11, minUndequeuedBuffers : 5 I/ACodec (18054): [OMX.qcom.video.decoder.avc] Now Executing E/GLConsumer(18054): [SurfaceTexture-0-18054-0] attachToContext: invalid current EGLDisplay E/flutter (18054): [ERROR:flutter/shell/platform/android/platform_view_android_jni_impl.cc(43)] java.lang.RuntimeException: Error during attachToGLContext (see logcat for details) E/flutter (18054): at android.graphics.SurfaceTexture.attachToGLContext(SurfaceTexture.java:286) E/flutter (18054): F/flutter (18054): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1062)] Check failed: CheckException(env). F/libc (18054): Fatal signal 6 (SIGABRT), code -6 in tid 18097 (1.raster) *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/a5lteub/a5lte:6.0.1/MMB29M/A500MUBS1CRI6:user/release-keys' Revision: '10' ABI: 'arm' pid: 18054, tid: 18097, name: 1.raster >>> com.example.QrCode <<< signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1062)] Check failed: CheckException(env). ' r0 00000000 r1 000046b1 r2 00000006 r3 9e25c978 r4 9e25c980 r5 9e25c930 r6 00000000 r7 0000010c r8 9e25b280 r9 b8ced2a0 sl 9e25c4e0 fp b8bbe958 ip 00000006 sp 9e25ae40 lr b6cd8f15 pc b6cdb310 cpsr 400f0010 backtrace: #00 pc 00044310 /system/lib/libc.so (tgkill+12) #01 pc 00041f11 /system/lib/libc.so (pthread_kill+32) #02 pc 0001ba13 /system/lib/libc.so (raise+10) #03 pc 00018c81 /system/lib/libc.so (__libc_android_abort+34) #04 pc 00016840 /system/lib/libc.so (abort+4) #05 pc 00012583 /data/app/com.example.QrCode-2/lib/arm/libflutter.so (offset 0x1002000)
And here's the code:
import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; class VideoPlayerView extends StatefulWidget { VideoPlayerView({ Key key, @required this.videoFile, }) : super(key: key); final File videoFile; // VideoPlayerView({ // @required this.videoFile, // }); @override _VideoPlayerViewState createState() => _VideoPlayerViewState(); } class _VideoPlayerViewState extends State<VideoPlayerView> { VideoPlayerController _controller; @override void 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(() { _controller.play(); }); }); } @override Widget build(BuildContext context) { return MaterialApp( title: 'Video Demo', home: 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, ), ), ), ); } @override void dispose() { super.dispose(); _controller.dispose(); } }