Chewie Video Player In Flutter

Chewie Video Player In Flutter :

This flutter tutorial post video display in next page using Chewie Video Player In Flutter.

How to use :
MovieVideoPlay(url: ‘url’)

Chewie Video Player In Flutter

chewie video player.dart

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

class MovieVideoPlay extends StatefulWidget {
  final String url;

  const MovieVideoPlay({Key key, this.url}) : super(key: key);
  @override
  _MovieVideoPlayState createState() => _MovieVideoPlayState();
}

class _MovieVideoPlayState extends State<MovieVideoPlay> {

  VideoPlayerController videoPlayerController;
  ChewieController chewieController;

  @override
  void initState() { 
    super.initState();
    videoPlayerController = VideoPlayerController.network(this.widget.url);
    chewieController = ChewieController(
      videoPlayerController: videoPlayerController,
      aspectRatio: 3 / 2,
      autoPlay: true,
      looping: true,

      // showControls: false,
      // materialProgressColors: ChewieProgressColors(
      //   playedColor: Colors.red,
      //   handleColor: Colors.blue,
      //   backgroundColor: Colors.grey,
      //   bufferedColor: Colors.lightGreen,
      // ),
      // placeholder: Container(
      //   color: Colors.grey,
      // ),
      // autoInitialize: true,
    );
  }

  @override
  void dispose() {
    videoPlayerController.dispose();
    chewieController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
            color: Colors.black
        ),
        constraints: BoxConstraints.expand(
            height: MediaQuery.of(context).size.height,
          ),
        child: Chewie(
          controller: chewieController
        )
      ),
    );
  }
}

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in