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

Platformweb

Youtube Iframe API interop

Dart

Dart Youtube iframe interop #

JS interop for Youtube Iframe API

Exemple #

import 'package:youtube_iframe_interop/youtube_iframe_interop.dart' as youtube;
import 'package:js/js.dart';

Future<void> main() async {
  await youtube.loadYoutubeIframeApi();

  youtube.onYouTubeIframeAPIReady = allowInterop(iframeReady);
}

void iframeReady() {
  final onReady = (youtube.PlayerEvent e) {
    e.target.playVideo();
  };

  youtube.Player(
    'player',
    youtube.PlayerOptions(
      height: 390,
      width: 640,
      videoId: 'M7lc1UVf-VE',
      events: youtube.Events(
        onReady: allowInterop(onReady),
      ),
    ),
  );
}
1
likes
130
points
104
downloads

Publisher

verified publisherlefty.io

Weekly Downloads

Youtube Iframe API interop

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

dart_browser_loader, js

More

Packages that depend on youtube_iframe_interop