flutter_radio_player 2.0.3 copy "flutter_radio_player: ^2.0.3" to clipboard
flutter_radio_player: ^2.0.3 copied to clipboard

Online Radio Player for Flutter which enable to play streaming URL. Supports Android and iOS as well as WearOs and watchOs

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_radio_player/flutter_radio_player.dart';
import 'package:flutter_radio_player/models/frp_source_modal.dart';
import 'package:flutter_radio_player_example/frp_player.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

class _MyAppState extends State<MyApp> {
  final FlutterRadioPlayer _flutterRadioPlayer = FlutterRadioPlayer();

  final FRPSource frpSource = FRPSource(
    mediaSources: <MediaSources>[
      MediaSources(
        url: "http://167.71.37.143:8000/radio.mp3",
        description: "ONMAX.FM",
        isPrimary: true,
        title: "ONMAX.FM",
        isAac: true,
      ),
      MediaSources(
        url: "https://radio.lotustechnologieslk.net:2020/stream/hirufmgarden",
        description: "Hiru FM Sri Lanka",
        isPrimary: false,
        title: "HiruFM",
        isAac: false,
      ),
    ],
  );

  @override
  void initState() {
    super.initState();
    _flutterRadioPlayer.initPlayer();
    _flutterRadioPlayer.addMediaSources(frpSource);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Radio Player'),
        ),
        body: Center(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Container(
                margin: const EdgeInsets.all(10),
                padding: const EdgeInsets.all(5),
                child: Column(
                  children: [
                    FRPlayer(
                      flutterRadioPlayer: _flutterRadioPlayer,
                      frpSource: frpSource,
                      useIcyData: true,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
128
likes
160
pub points
85%
popularity

Publisher

unverified uploader

Online Radio Player for Flutter which enable to play streaming URL. Supports Android and iOS as well as WearOs and watchOs

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on flutter_radio_player