0

when I debug my code it show me error

import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  State<MyApp> createState() => _MyAppState();
}

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

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

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

class _HomeState extends State<Home> {
  late VideoPlayerController _controller;
  @override
  void initState() {
    _controller = VideoPlayerController.asset("assets/041 Wrap Up_.mp4")
      ..initialize().then((_) {
        setState(() {});
      });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Video player app"),
      ),
      body: content(),
    );
  }

  Widget content() {
    return Container(
      width: 350,
      height: 350,
      child: _controller.value.isInitialized
          ? VideoPlayer(_controller)
          : Container(),
    );
  }
}

debug message.

E/flutter (22092): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null) E/flutter (22092)

enter image description here

M.Shahzad
  • 106
  • 10

1 Answers1

0

just run flutter clean and restart your app instead of hot reload

Mr Jeeva
  • 1
  • 1
  • of i will try it and i let you know – M.Shahzad Feb 25 '23 at 10:42
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 04 '23 at 09:47