cached_video_player 1.0.3
cached_video_player: ^1.0.3 copied to clipboard

A new flutter plugin that is virtually a clone of official video_player plugin except that it supports caching( Android and iOS)

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  CachedVideoPlayerController controller;
  @override
  void initState() {
    controller = CachedVideoPlayerController.network(
        "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4");
    controller.initialize().then((_) {
      setState(() {});
      controller.play();
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: controller.value != null && controller.value.initialized
              ? AspectRatio(
                  child: CachedVideoPlayer(controller),
                  aspectRatio: controller.value.aspectRatio,
                )
              : Center(
                  child: CircularProgressIndicator(),
                )),
    );
  }
}
76
likes
100
pub points
92%
popularity

Publisher

lazyarts.in

A new flutter plugin that is virtually a clone of official video_player plugin except that it supports caching( Android and iOS)

Repository (GitHub)
View/report issues

Documentation

API reference

License

LICENSE

Dependencies

flutter

More

Packages that depend on cached_video_player