easy_chromecast_plugin 1.0.0 copy "easy_chromecast_plugin: ^1.0.0" to clipboard
easy_chromecast_plugin: ^1.0.0 copied to clipboard

retracted

A modern, type-safe Flutter plugin for Google Chromecast. Powered by Kotlin and Pigeon, optimized for streaming VOD and Live IPTV streams (.ts, .m3u8, .mp4).

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  // Maak een instantie aan van jouw eigen plugin
  final _plugin = EasyChromecastPlugin();
  bool _isConnected = false;

  @override
  void initState() {
    super.initState();
    // Initialiseer de Cast SDK zodra de app start
    _plugin.initializeCast();
  }

  Future<void> _checkConnection() async {
    final connected = await _plugin.isConnected();
    setState(() {
      _isConnected = connected;
    });
  }

  void _startStreaming() {
    // Dit is een officiële, CORS-vrije Apple HLS test-stream (Adaptive Bitrate)
    // Chromecast-ontvangers spelen dit type streams vele malen stabieler af dan rauwe MP4's
    _plugin.playMedia(
      url: 'http://line.tvprostreaming.live:80/movie/dd03da96e3/ff4d71190ddf/1059111.mp4',
      title: 'A Christmas Carol',
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Easy Chromecast Test')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Verbonden met Chromecast: $_isConnected'),
              const SizedBox(height: 20),

              // NIEUWE KNOP: Opent het Chromecast selectievenster
              ElevatedButton(
                onPressed: () async {
                  await _plugin.showCastDialog();
                },
                style: ElevatedButton.styleFrom(backgroundColor: Colors.blue),
                child: const Text('Zoek & Verbind Chromecast', style: TextStyle(color: Colors.white)),
              ),

              const SizedBox(height: 10),
              ElevatedButton(onPressed: _checkConnection, child: const Text('Check Status')),
              const SizedBox(height: 10),
              ElevatedButton(onPressed: _startStreaming, child: const Text('Stream Video naar Cast')),
              const SizedBox(height: 10),
              ElevatedButton(onPressed: () => _plugin.stopMedia(), child: const Text('Stop Media')),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
0
points
615
downloads

Publisher

verified publisherjdbs.nl

Weekly Downloads

A modern, type-safe Flutter plugin for Google Chromecast. Powered by Kotlin and Pigeon, optimized for streaming VOD and Live IPTV streams (.ts, .m3u8, .mp4).

Repository (GitHub)
View/report issues

Topics

#chromecast #google-cast #iptv #video-streaming #media-player

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on easy_chromecast_plugin

Packages that implement easy_chromecast_plugin