-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
c: crashStack traces logged to the consoleStack traces logged to the consolee: device-specificOnly manifests on certain devicesOnly manifests on certain devicesp: video_playerThe Video Player pluginThe Video Player pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallywaiting for PR to land (fixed)A fix is in flightA fix is in flight
Milestone
Description
When popping a page that contains a video on it, and disposing of the video controller in the dispose method could very often cause a crash on an iPhoneX running iOS 12. This happens because the DisplayLink has notified the flutter Texture registry that a frame is ready, and the flutter GPU thread then tries to get the pixel buffer after the FLTVideoPlayer object has been destructed.
The following code leads to the problem:
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
class VideoCrashPlayerPage extends StatefulWidget {
@override
_VideoCrashPlayerPageState createState() => _VideoCrashPlayerPageState();
}
class _VideoCrashPlayerPageState extends State<VideoCrashPlayerPage> {
VideoPlayerController _videoPlayerController;
@override
void initState() {
super.initState();
_videoPlayerController = VideoPlayerController.asset("videos/video.mp4");
_videoPlayerController.addListener(() {
if (!_videoPlayerController.value.isPlaying) {
Navigator.pop(context);
}
});
_videoPlayerController.play();
_videoPlayerController.initialize();
}
@override
void dispose() {
_videoPlayerController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
elevation: 0,
child: Column(
children: <Widget>[
Expanded(
child: FittedBox(
fit: BoxFit.cover,
child: Container(
width: 818.0,
height: 864.0,
child: VideoPlayer(_videoPlayerController)
),
)
)
],
)
);
}
}
Metadata
Metadata
Assignees
Labels
c: crashStack traces logged to the consoleStack traces logged to the consolee: device-specificOnly manifests on certain devicesOnly manifests on certain devicesp: video_playerThe Video Player pluginThe Video Player pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallywaiting for PR to land (fixed)A fix is in flightA fix is in flight