cached_video_player_plus 4.0.3 copy "cached_video_player_plus: ^4.0.3" to clipboard
cached_video_player_plus: ^4.0.3 copied to clipboard

The video_player plugin that went to therapy, worked on its commitment issues, and now actually remembers your videos!

example/example.md

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Cached Video Player Plus Demo',
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late final CachedVideoPlayerPlus _player;

  @override
  void initState() {
    super.initState();
    _player = CachedVideoPlayerPlus.networkUrl(
      Uri.parse(
        'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
      ),
      invalidateCacheIfOlderThan: const Duration(minutes: 69),
    );
    _player.initialize().then((value) async {
      await _player.controller.setLooping(true);
      _player.controller.play();
      if (mounted) setState(() {});
    });
  }

  @override
  void dispose() {
    _player.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Cached Video Player Plus Demo')),
      body: Center(
        child: _player.isInitialized
            ? AspectRatio(
                aspectRatio: _player.controller.value.aspectRatio,
                child: VideoPlayer(_player.controller),
              )
            : const CircularProgressIndicator.adaptive(),
      ),
    );
  }
}

111
likes
160
points
39.9k
downloads
screenshot

Publisher

verified publisheroutdatedguy.rocks

Weekly Downloads

The video_player plugin that went to therapy, worked on its commitment issues, and now actually remembers your videos!

Homepage
Repository (GitHub)

Topics

#caching #video-caching #video #video-player

Documentation

API reference

Funding

Consider supporting this project:

coff.ee
github.com

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_cache_manager, get_storage, shared_preferences, video_player

More

Packages that depend on cached_video_player_plus