audio_cast 0.0.1+1 copy "audio_cast: ^0.0.1+1" to clipboard
audio_cast: ^0.0.1+1 copied to clipboard

unlisted

A package for casting audio to streaming devices such as Hi-Fi systems and streaming sticks, written in pure Dart.

example/audio_cast_example.dart

import 'package:audio_cast/audio_cast.dart';

void main() async {
  AudioCast.playbackStateStream.listen((s) async {
    print('New playbackState: ' + s.toString());
  });

  AudioCast.initialize();

  await for (Set<Device> deviceList in AudioCast.deviceStream) {
    print('Updated devices');

    if (deviceList.isNotEmpty) {
      var device = deviceList.first;
      print(device.name);

      await AudioCast.connectToDevice(device);

      await AudioCast.castAudioFromUrl(
        'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3',
        mediaData: MediaData(title: 'testTitle', album: 'album'),
        start: const Duration(seconds: 30),
      );

      await Future.delayed(Duration(seconds: 5));
      await AudioCast.fastForward();

      await Future.delayed(Duration(seconds: 5));
      print(await AudioCast.getPosition());

      await Future.delayed(Duration(seconds: 5));
      await AudioCast.pause();

      await Future.delayed(Duration(seconds: 5));
      await AudioCast.play();

      await Future.delayed(Duration(seconds: 5));
      await AudioCast.rewind();

      await Future.delayed(Duration(seconds: 5));
      await AudioCast.increaseVolume();

      await Future.delayed(Duration(seconds: 13));
      await AudioCast.disconnect();
    }
  }

  AudioCast.shutdown();
}
1
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A package for casting audio to streaming devices such as Hi-Fi systems and streaming sticks, written in pure Dart.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

file, http, http_server, mp3_info, multicast_dns, state_notifier, upnp, xml

More

Packages that depend on audio_cast