A cross-platform media playback library for C/C++ & Flutter

libwinmedia.dart

Flutter bindings to libwinmedia.



 

Install

dependencies:
  ...
  libwinmedia: ^0.0.3

Example

A very simple example can be as follows.

import 'package:libwinmedia/libwinmedia.dart';

void main() {
  LWM.initialize();
  runApp(MyApp());
}

void demo() {
  var player = Player(id: 0);
  player.streams.medias.listen((List<Media> medias) {});
  player.streams.isPlaying.listen((bool isPlaying) {});
  player.streams.isBuffering.listen((bool isBuffering) {});
  player.streams.isCompleted.listen((bool isCompleted) {});
  player.streams.position.listen((Duration position) {});
  player.streams.duration.listen((Duration duration) {});
  player.streams.index.listen((int index) {});
  player.open([
    Media(uri: 'https://www.example.com/media/music.mp3'),
    Media(uri: 'file://C:/documents/video.mp4'),
  ]);
  player.play();
  player.seek(Duration(seconds: 20));
  player.nativeControls.update(
    album: 'Fine Line',
    albumArtist: 'Harry Styles',
    trackCount: 12,
    artist: 'Harry Styles',
    title: 'Lights Up',
    trackNumber: 1,
    thumbnail: File('album_art.png'),
  );
}

Checkout the other APIs & docstrings within the project, for more detailed information. Those are the most updated source of documentation.

Support

Consider supporting the project by starring the repository or buying me a coffee.

Thanks a lot for your support.

Contributions

Contributions to the project are welcomed, either it be API improvements or documentation changes. Let's make it better.

License

MIT

Copyright © 2021, Hitesh Kumar Saini <saini123hitesh@gmail.com>

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add libwinmedia

With Flutter:

 $ flutter pub add libwinmedia

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  libwinmedia: ^0.0.7

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:libwinmedia/libwinmedia.dart'; 

example/lib/main.dart

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

void main() {
  LWM.initialize();
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  final player = Player(id: 0);
  int index = 0;
  List<Media> medias = [];
  double volume = 1.0;
  double rate = 1.0;
  bool isPlaying = false;
  bool isBuffering = false;
  bool isCompleted = false;
  Duration duration = Duration.zero;
  Duration position = Duration.zero;
  String uri = '';
  double downloadProgress = 0.0;
  @override
  void initState() {
    super.initState();
    player.streams.index.listen((event) {
      index = event;
      setState(() {});
    });
    player.streams.medias.listen((event) {
      medias = event;
      setState(() {});
    });
    player.streams.isPlaying.listen((event) {
      isPlaying = event;
      setState(() {});
    });
    player.streams.isBuffering.listen((event) {
      isBuffering = event;
      setState(() {});
    });
    player.streams.isCompleted.listen((event) {
      isCompleted = event;
      setState(() {});
    });
    player.streams.duration.listen((event) {
      duration = event;
      setState(() {});
    });
    player.streams.position.listen((event) {
      position = event;
      setState(() {});
    });
    player.streams.downloadProgress.listen((event) {
      downloadProgress = event;
      setState(() {});
    });
    player.streams.error.listen((event) {
      print(event);
    });
  }

  void open() {
    player.open(
      [
        Media(uri: uri),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('libwinmedia'),
        ),
        body: ListView(
          padding: EdgeInsets.symmetric(
            vertical: 4.0,
          ),
          children: [
            Padding(
              padding: EdgeInsets.symmetric(
                horizontal: 8.0,
                vertical: 4.0,
              ),
              child: Card(
                elevation: 2.0,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Padding(
                      padding:
                          EdgeInsets.only(top: 16.0, left: 16.0, bottom: 8.0),
                      child: Text('Open URI into Player'),
                    ),
                    Padding(
                      padding: EdgeInsets.only(
                          top: 8.0, left: 16.0, right: 16.0, bottom: 16.0),
                      child: Row(
                        children: [
                          Expanded(
                            child: TextField(
                              onChanged: (value) => uri = value,
                              cursorWidth: 1.0,
                              style: TextStyle(
                                fontSize: 14.0,
                              ),
                              onSubmitted: (_) => open(),
                              decoration: InputDecoration(
                                hintText:
                                    'Enter a URI like file:///home/alexmercerind/music.mp3 or https://alexmercerind.github.io/music.ogg',
                                hintStyle: TextStyle(
                                  fontSize: 14.0,
                                ),
                                border: UnderlineInputBorder(
                                  borderSide: BorderSide(width: 2.0),
                                ),
                                focusedBorder: UnderlineInputBorder(
                                  borderSide: BorderSide(
                                    width: 2.0,
                                    color: Theme.of(context).primaryColor,
                                  ),
                                ),
                              ),
                            ),
                          ),
                          SizedBox(
                            width: 12.0,
                          ),
                          ElevatedButton(
                            onPressed: open,
                            child: Text('Open'),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Padding(
              padding: EdgeInsets.symmetric(
                horizontal: 8.0,
                vertical: 4.0,
              ),
              child: Card(
                elevation: 2.0,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Padding(
                      padding:
                          EdgeInsets.only(top: 16.0, left: 16.0, bottom: 8.0),
                      child: Text('Player controls'),
                    ),
                    Padding(
                      padding: EdgeInsets.only(
                          top: 4.0, left: 16.0, right: 16.0, bottom: 8.0),
                      child: Row(
                        children: [
                          ElevatedButton(
                            onPressed: player.play,
                            child: Text('Play'),
                          ),
                          SizedBox(
                            width: 12.0,
                          ),
                          ElevatedButton(
                            onPressed: player.pause,
                            child: Text('Pause'),
                          ),
                        ],
                      ),
                    ),
                    Padding(
                      padding: EdgeInsets.only(
                          top: 4.0, left: 16.0, right: 16.0, bottom: 4.0),
                      child: Row(
                        children: [
                          Text('Player volume'),
                          Slider(
                            value: volume,
                            min: 0.0,
                            max: 1.0,
                            onChanged: (value) {
                              player.volume = value;
                              volume = value;
                              setState(() {});
                            },
                          ),
                          Text('Player rate'),
                          Slider(
                            value: rate,
                            min: 0.0,
                            max: 2.0,
                            onChanged: (value) {
                              player.rate = value;
                              rate = value;
                              setState(() {});
                            },
                          ),
                        ],
                      ),
                    ),
                    Padding(
                      padding: EdgeInsets.only(
                          top: 4.0, left: 16.0, right: 16.0, bottom: 4.0),
                      child: Text('Player position'),
                    ),
                    Padding(
                      padding: EdgeInsets.only(
                          top: 4.0, left: 16.0, right: 16.0, bottom: 16.0),
                      child: Row(
                        children: [
                          Text(position.toString()),
                          Expanded(
                            child: Slider(
                              value: position.inMilliseconds.toDouble(),
                              min: 0.0,
                              max: duration.inMilliseconds.toDouble(),
                              onChanged: (value) {
                                player.seek(
                                  Duration(
                                    milliseconds: value ~/ 1,
                                  ),
                                );
                                setState(() {});
                              },
                            ),
                          ),
                          Text(duration.toString()),
                        ],
                      ),
                    ),
                    Padding(
                      padding: EdgeInsets.all(8.0),
                      child: Text(
                        'Player has playlists, which are not shown in the example.',
                        style: TextStyle(color: Colors.black.withOpacity(0.67)),
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Padding(
              padding: EdgeInsets.symmetric(
                horizontal: 8.0,
                vertical: 4.0,
              ),
              child: Card(
                elevation: 2.0,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Padding(
                      padding:
                          EdgeInsets.only(top: 16.0, left: 16.0, bottom: 0.0),
                      child: Text('Player state'),
                    ),
                    Padding(
                      padding: EdgeInsets.only(
                          top: 4.0, left: 16.0, right: 16.0, bottom: 16.0),
                      child: DataTable(
                        columns: [
                          DataColumn(label: Text('attribute')),
                          DataColumn(label: Text('value')),
                        ],
                        rows: [
                          DataRow(cells: [
                            DataCell(Text('player.state.index')),
                            DataCell(Text('$index')),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.state.medias')),
                            DataCell(Text(
                              '$medias',
                              maxLines: 1,
                              overflow: TextOverflow.ellipsis,
                            )),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.state.isPlaying')),
                            DataCell(Text('$isPlaying')),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.state.isBuffering')),
                            DataCell(Text('$isBuffering')),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.state.isCompleted')),
                            DataCell(Text('$isCompleted')),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.state.downloadProgress')),
                            DataCell(Text('$downloadProgress')),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.volume')),
                            DataCell(Text('$volume')),
                          ]),
                          DataRow(cells: [
                            DataCell(Text('player.rate')),
                            DataCell(Text('$rate')),
                          ]),
                        ],
                      ),
                    ),
                    Padding(
                      padding: EdgeInsets.all(8.0),
                      child: Text(
                        'Other event streams have not been shown in the example.',
                        style: TextStyle(color: Colors.black.withOpacity(0.67)),
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Padding(
              padding: EdgeInsets.all(16.0),
              child: Text(
                'MIT\nhttps://github.com/harmonoid/libwinmedia\nCopyright © 2020 Hitesh Kumar Saini <saini123hitesh@gmail.com>',
                style: TextStyle(color: Colors.black.withOpacity(0.67)),
              ),
            ),
          ],
        ),
      ),
    );
  }
} 

Download Details:

Author: harmonoid

Source Code: https://github.com/harmonoid/libwinmedia

#flutter #android #ios 

What is GEEK

Buddha Community

A cross-platform media playback library for C/C++ & Flutter

Google's Flutter 1.20 stable announced with new features - Navoki

Flutter Google cross-platform UI framework has released a new version 1.20 stable.

Flutter is Google’s UI framework to make apps for Android, iOS, Web, Windows, Mac, Linux, and Fuchsia OS. Since the last 2 years, the flutter Framework has already achieved popularity among mobile developers to develop Android and iOS apps. In the last few releases, Flutter also added the support of making web applications and desktop applications.

Last month they introduced the support of the Linux desktop app that can be distributed through Canonical Snap Store(Snapcraft), this enables the developers to publish there Linux desktop app for their users and publish on Snap Store.  If you want to learn how to Publish Flutter Desktop app in Snap Store that here is the tutorial.

Flutter 1.20 Framework is built on Google’s made Dart programming language that is a cross-platform language providing native performance, new UI widgets, and other more features for the developer usage.

Here are the few key points of this release:

Performance improvements for Flutter and Dart

In this release, they have got multiple performance improvements in the Dart language itself. A new improvement is to reduce the app size in the release versions of the app. Another performance improvement is to reduce junk in the display of app animation by using the warm-up phase.

sksl_warm-up

If your app is junk information during the first run then the Skia Shading Language shader provides for pre-compilation as part of your app’s build. This can speed it up by more than 2x.

Added a better support of mouse cursors for web and desktop flutter app,. Now many widgets will show cursor on top of them or you can specify the type of supported cursor you want.

Autofill for mobile text fields

Autofill was already supported in native applications now its been added to the Flutter SDK. Now prefilled information stored by your OS can be used for autofill in the application. This feature will be available soon on the flutter web.

flutter_autofill

A new widget for interaction

InteractiveViewer is a new widget design for common interactions in your app like pan, zoom drag and drop for resizing the widget. Informations on this you can check more on this API documentation where you can try this widget on the DartPad. In this release, drag-drop has more features added like you can know precisely where the drop happened and get the position.

Updated Material Slider, RangeSlider, TimePicker, and DatePicker

In this new release, there are many pre-existing widgets that were updated to match the latest material guidelines, these updates include better interaction with Slider and RangeSliderDatePicker with support for date range and time picker with the new style.

flutter_DatePicker

New pubspec.yaml format

Other than these widget updates there is some update within the project also like in pubspec.yaml file format. If you are a flutter plugin publisher then your old pubspec.yaml  is no longer supported to publish a plugin as the older format does not specify for which platform plugin you are making. All existing plugin will continue to work with flutter apps but you should make a plugin update as soon as possible.

Preview of embedded Dart DevTools in Visual Studio Code

Visual Studio code flutter extension got an update in this release. You get a preview of new features where you can analyze that Dev tools in your coding workspace. Enable this feature in your vs code by _dart.previewEmbeddedDevTools_setting. Dart DevTools menu you can choose your favorite page embed on your code workspace.

Network tracking

The updated the Dev tools comes with the network page that enables network profiling. You can track the timings and other information like status and content type of your** network calls** within your app. You can also monitor gRPC traffic.

Generate type-safe platform channels for platform interop

Pigeon is a command-line tool that will generate types of safe platform channels without adding additional dependencies. With this instead of manually matching method strings on platform channel and serializing arguments, you can invoke native class and pass nonprimitive data objects by directly calling the Dartmethod.

There is still a long list of updates in the new version of Flutter 1.2 that we cannot cover in this blog. You can get more details you can visit the official site to know more. Also, you can subscribe to the Navoki newsletter to get updates on these features and upcoming new updates and lessons. In upcoming new versions, we might see more new features and improvements.

You can get more free Flutter tutorials you can follow these courses:

#dart #developers #flutter #app developed #dart devtools in visual studio code #firebase local emulator suite in flutter #flutter autofill #flutter date picker #flutter desktop linux app build and publish on snapcraft store #flutter pigeon #flutter range slider #flutter slider #flutter time picker #flutter tutorial #flutter widget #google flutter #linux #navoki #pubspec format #setup flutter desktop on windows

Platform App Design | Cross-Platform Development Services

Cross-Platform Development Services

With the development in mobile app technology, a huge time saver as well as the quality maintainer technology is Cross-Platform App development. The development of an app that takes less time to develop as well as uses one technology to develop an app for both android and iOS is game-changing technology in mobile app development.

Want to develop or design a Cross-platform app?

With the successful delivery of more than 950 projects, WebClues Infotech has got the expertise as well as a huge experience of cross-platform app development and design. With global offices in 4 continents and a customer presence in most developed countries, WebClues Infotech has got a huge network around the world.

Want to know more about our cross-platform app designs?

Visit: https://www.webcluesinfotech.com/cross-platform-design/

Share your requirements https://www.webcluesinfotech.com/contact-us/

View Portfolio https://www.webcluesinfotech.com/portfolio/

#cross-platform development services #cross platform mobile app development services #cross-platform mobile app development services #cross platform app development services #hire cross platform app developer #hire cross-platform app developer india usa,

Top Cross-Platform App Developers in USA

Are you looking for the best Cross-Platform app developers in USA? AppClues Infotech has the best expertise to create mobile app on Android & iOS platform. Get in touch with our team for the right Cross-Platform app development solution.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#cross-platform app development #cross-platform framework development #cross-platform mobile app development #top cross platform app developers in usa #top cross platform app developers in usa #develop a cross-platform mobile app

Cross Platform Mobile App Development Company in USA

AppClues Infotech is a top-notch cross platform mobile app development company in USA. With strong mobile app designers & developers team that help to create powerful cross-platform apps using the current market technologies & functionalities.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#cross platform mobile app development company #best cross platform mobile app development #cross platform app development services #top cross platform app development company #cross-platform app development usa #hire cross-platform app developer

Hire Cross-Platform App Developers

AppClues Infotech offers high-quality cross-platform mobile app development services. Our expert & highly skilled developers build innovative, robust, scalable & interactive mobile apps for your business needs with the most advanced tools & features.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#cross platform mobile app development company #best cross platform mobile app development #cross platform app development services #top cross platform app development company #hire cross-platform app developers #hire top cross-platform app developers usa