New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video player initialization become false when WiFi is turned off. #107802
Comments
Hi @rohaitas, Thanks for filing the issue. Is it happening with any specific video or all videos, I tried turning off the network, But I didn't see any issue, it continues playing the buffer. Screen.Recording.2022-07-18.at.7.24.43.PM.movPlease share a minimal and complete code sample along with the output of code sampleimport 'package:video_player/video_player.dart';
import 'package:flutter/material.dart';
void main() => runApp(VideoApp());
class VideoApp extends StatefulWidget {
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4')
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
home: Scaffold(
body: Center(
child: _controller.value.isInitialized
? 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() {
_controller.dispose();
super.dispose();
}
}
flutter doctor -v (mac)
|
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
I wanted to create my custom player on top of the video player. flutter is new to me.
StackOverflow : https://stackoverflow.com/questions/72994826/flutter-videoplayer-isinitialized-become-false-when-wifi-turn-off
VideoPlayer(_controller,)
The scenario is when the controller is successfully initialized video gets played. when I turn off wifi of device & video playback has reached the buffering position. The videoplayer becomes uninitialized on real device
I/flutter (31130): ERROR : true isInitialized : false
Same is the case with emulator, if I turn the laptop wifi off. The player is initialized true. but if i goto setting and turn emulator wifi off then it becomes false
I/flutter ( 4366): ERROR : false isInitialized : true
Now that the player initialization has become false. If I turn wifi on. I cannot play that player. if I play() the video image disappears screen becomes black. nothing happens.
_controller.play();
so i had to initialize it again to playWhen I initialize it again. The buffering is lost. and video is played from the beginning. But storing the duration I can seek to that position. but is there a way to avoid that what should i do? Why player is losing initialization on wifi?
init method
The text was updated successfully, but these errors were encountered: