warble 0.0.1 copy "warble: ^0.0.1" to clipboard
warble: ^0.0.1 copied to clipboard

outdated

An audio player for the go-flutter desktop engine, built on the beep library.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:async';

import 'package:warble/warble.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    example();
  }

  String _text = "Playing!";

  Future<void> example() async {
    WarbleStream stream = (await Warble.wrapAsset(rootBundle, "assets/chime.wav", buffered: true))!;

    stream.play();
    Future.delayed(Duration(seconds:3)).then((_) {
      stream.playBuffered(0, stream.length);
      setState(() {
        _text = "Playing buffered";
      });
    });
    Future.delayed(Duration(seconds:6)).then((_) {
      stream.play();
      setState(() {
        _text = "Seeking and replaying";
      });
    });
    Future.delayed(Duration(milliseconds:7500)).then((_) {
      stream.seek(0);
      setState(() {
        _text = "Seeking during playback";
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text(_text),
        ),
      ),
    );
  }
}
4
likes
0
pub points
23%
popularity

Publisher

unverified uploader

An audio player for the go-flutter desktop engine, built on the beep library.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, path_provider

More

Packages that depend on warble