video_cast 1.0.1 copy "video_cast: ^1.0.1" to clipboard
video_cast: ^1.0.1 copied to clipboard

PlatformAndroid

Flutter plugin for casting videos on chromecast devices

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:video_cast/chrome_cast_media_type.dart';
import 'package:video_cast/video_cast.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  ChromeCastController? castController;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              const Text("ChromeCastButton"),
              const SizedBox(
                height: 5,
              ),
              ChromeCastButton(
                color: Colors.red,
                onButtonCreated: (controller) {
                  castController = controller;
                  castController?.addSessionListener();
                },
                onSessionEnding: (position) {
                  print("in app ending");
                  print("position is $position");
                },
                onSessionEnded: () {
                  print("in app ended");
                },
                onSessionStarted: () {
                  print("in app started");
                  castController?.loadMedia(
                    url:
                        "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
                    position: 30000,
                    autoplay: true,
                    title: "Spider-Man: No Way Home",
                    description:
                        "Peter Parker is unmasked and no longer able to separate his normal life from the high-stakes of being a super-hero. When he asks for help from Doctor Strange the stakes become even more dangerous, forcing him to discover what it truly means to be Spider-Man.",
                    image:
                        "https://terrigen-cdn-dev.marvel.com/content/prod/1x/marvsmposterbk_intdesign.jpg",
                    type: ChromeCastMediaType.movie,
                  );
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
9
likes
140
pub points
80%
popularity

Publisher

unverified uploader

Flutter plugin for casting videos on chromecast devices

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, plugin_platform_interface, stream_transform

More

Packages that depend on video_cast