abdelaziz-mahdy / flutter_meedu_videoplayer

Cross-Platform Video Player for flutter
https://abdelaziz-mahdy.github.io/flutter_meedu_videoplayer/
MIT License
132 stars 69 forks source link

on Windows and encountered initialization failure,Working normally on the move #83

Closed JieNengi closed 1 year ago

JieNengi commented 1 year ago

I used it on Windows and encountered initialization failure,Working normally on the move image

there is code:

void main() { runApp(const MyApp()); }

class MyApp extends StatefulWidget { const MyApp({super.key});

@override State createState() => _MyAppState(); }

class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( home: Home(), ); } }

class Home extends StatefulWidget { const Home({super.key});

@override State createState() => _HomeState(); }

class _HomeState extends State { late MeeduPlayerController _meeduPlayerController;

@override void initState() { // TODO: implement initState _meeduPlayerController.setDataSource( DataSource( type: DataSourceType.network, source: "https://vip.lz-cdn14.com/20230411/21645_f68e95f2/index.m3u8", ), autoplay: true, ); super.initState(); }

@override Widget build(BuildContext context) { return Scaffold( body: AspectRatio( aspectRatio: 16 / 9, child: MeeduVideoPlayer(controller: _meeduPlayerController), ), ); } }

JieNengi commented 1 year ago

When I try this, I am prompted with a new error。 image image

abdelaziz-mahdy commented 1 year ago

I used it on Windows and encountered initialization failure,Working normally on the move image

there is code:

void main() { runApp(const MyApp()); }

class MyApp extends StatefulWidget { const MyApp({super.key});

@override State createState() => _MyAppState(); }

class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( home: Home(), ); } }

class Home extends StatefulWidget { const Home({super.key});

@override State createState() => _HomeState(); }

class _HomeState extends State { late MeeduPlayerController _meeduPlayerController;

@override void initState() { // TODO: implement initState _meeduPlayerController.setDataSource( DataSource( type: DataSourceType.network, source: "https://vip.lz-cdn14.com/20230411/21645_f68e95f2/index.m3u8", ), autoplay: true, ); super.initState(); }

@override Widget build(BuildContext context) { return Scaffold( body: AspectRatio( aspectRatio: 16 / 9, child: MeeduVideoPlayer(controller: _meeduPlayerController), ), ); } }

For this you didn't add the controller late MeeduPlayerController _meeduPlayerController;

abdelaziz-mahdy commented 1 year ago

When I try this, I am prompted with a new error。 image image

Did you add this?

void main() {
  initMeeduPlayer(); //this line
  runApp(MyApp());
}
JieNengi commented 1 year ago

When I try this, I am prompted with a new error。 image image

Did you add this?

void main() {
  initMeeduPlayer(); //this line
  runApp(MyApp());
}

Thanks, it solved my problem perfectly!