title: How do i play a network video in flutter
body: <p>I am trying to put a network video from a different site in Flutter.</p>
  <p>I have used the <strong>video_player</strong> package. I have used a future builder in which, the <code>CircularProgressIndicator</code> will keep running until the video is loaded. When i run the app, in the start the <code>CircularProgressIndicator</code> keep on running and after a few seconds it stops as if the video is loaded but it show complete blankness on the emulator. In other words the video is not loading.</p>
  <h2>After i start the app</h2>
  <p><a href="https://i.stack.imgur.com/8iS2G.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8iS2G.jpg" alt="enter image description here" /></a></p>
  <h2>After Loading</h2>
  <p><a href="https://i.stack.imgur.com/ZRh0C.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZRh0C.jpg" alt="enter image description here" /></a></p>
  <p><strong>This is the code</strong> <br/></p>
  <pre><code>class MyHomePage extends StatefulWidget {
    @override
  _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    VideoPlayerController _controller;
    Future&lt;void&gt; _initializeVideoPlayerFuture;
  
    @override
    void initState() {
      _controller = VideoPlayerController.network(
          'https://ok.ru/videoembed/1616636152346');
      _initializeVideoPlayerFuture = _controller.initialize();
      _controller.setLooping(true);
      _controller.setVolume(1.0);
      super.initState();
    }
  
  
    @override
    void dispose() {
      _controller.dispose();
      super.dispose();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.blue,
        ),
        body: FutureBuilder(
          future: _initializeVideoPlayerFuture,
          builder: (context, snapshot){
            if(snapshot.connectionState == ConnectionState.done){
              return AspectRatio(
                aspectRatio: _controller.value.aspectRatio,
                child: VideoPlayer(_controller),
              );
            } else {
              return Center(
                child: CircularProgressIndicator(backgroundColor: Colors.blue,
                ),
              );
            }
          }
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: (){
            setState(() {
              if(_controller.value.isPlaying){
                _controller.pause();
              }else{
                _controller.play();
              }
            });
          },
          child: Icon(_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
        ),
      ),
      );
    }
  }
  </code></pre>