dlna 0.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

DLNA-Dart #

A simple DLNA DMC library implemented by Dart.
It is tiny and only the basic network video casting function is supported.

Structure #

structure

Flutter Demo #

Flutter-DLNA

Usage #

Android Manifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

Pub

https://pub.dev/packages/dlna

Import

import 'package:dlna/dlna.dart';
var dlnaManager = DLNAManager();
dlnaManager.setRefresher(DeviceRefresher(onDeviceAdd: (dlnaDevice) {
    print('add ' + dlnaDevice.toString());
}, onDeviceRemove: (dlnaDevice) {
    print('remove ' + dlnaDevice.toString());
}, onDeviceUpdate: (dlnaDevice) {
    print('update ' + dlnaDevice.toString());
}, onSearchError: (error) {
    print(error);
}));
dlnaManager.startSearch();
dlnaManager.stopSearch();

Send the video url to the device

var didlObject = VideoObject(title, url, VideoObject.VIDEO_MP4);
await dlnaManager.actSetVideoUrl(didlObject);

Release server

dlnaManager.release();

Search Cache

For the quick search, when the device is found, it is saved locally.

dlnaManager.enableCache();
var localDevices = dlnaManager.getLocalDevices();

[0.0.1] #

  • Fist commit.

example/main.dart

import 'package:dlna/dlna.dart';

Future<void> main() async {
  var dlnaService = DLNAManager();
  dlnaService.setRefresher(DeviceRefresher(onDeviceAdd: (dlnaDevice) {
    print('\n${DateTime.now()}\nadd ' + dlnaDevice.toString());
  }, onDeviceRemove: (dlnaDevice) {
    print('\n${DateTime.now()}\nremove ' + dlnaDevice.toString());
  }, onDeviceUpdate: (dlnaDevice) {
    print('\n${DateTime.now()}\nupdate ' + dlnaDevice.toString());
  }, onSearchError: (error) {
    print(error);
  }, onPlayProgress: (positionInfo) {
    print('current play progress ' + positionInfo.relTime);
  }));
  dlnaService.startSearch();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dlna: ^0.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:dlna/dlna.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:dlna/dlna.dart that imports:
  • package:dlna/src/dlna_manager.dart that imports:
  • package:dlna/src/ssdp/device_manager.dart that imports:
  • package:dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform ios

Because:

  • package:dlna/dlna.dart that imports:
  • package:dlna/src/dlna_manager.dart that imports:
  • package:dlna/src/ssdp/device_manager.dart that imports:
  • package:dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform linux

Because:

  • package:dlna/dlna.dart that imports:
  • package:dlna/src/dlna_manager.dart that imports:
  • package:dlna/src/dlna_connectivity.dart that imports:
  • package:connectivity/connectivity.dart that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform macos

Because:

  • package:dlna/dlna.dart that imports:
  • package:dlna/src/dlna_manager.dart that imports:
  • package:dlna/src/ssdp/device_manager.dart that imports:
  • package:dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform web

Because:

  • package:dlna/dlna.dart that imports:
  • package:dlna/src/dlna_manager.dart that imports:
  • package:dlna/src/ssdp/device_manager.dart that imports:
  • package:dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that imports:
  • package:shared_preferences_linux/shared_preferences_linux.dart that declares support for platforms: linux

Package does not support Flutter platform windows

Because:

  • package:dlna/dlna.dart that imports:
  • package:dlna/src/dlna_manager.dart that imports:
  • package:dlna/src/ssdp/device_manager.dart that imports:
  • package:dlna/src/ssdp/local_device_parser.dart that imports:
  • package:shared_preferences/shared_preferences.dart that declares support for platforms: android, ios, linux, macos, web

Package not compatible with SDK dart

Because:

  • dlna that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.58 points)

351 out of 356 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/ssdp/ssdp_controller.dart. (-1 points)

Analysis of lib/src/ssdp/ssdp_controller.dart reported 2 hints:

line 28 col 25: Name non-constant identifiers using lowerCamelCase.

line 29 col 25: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/dlna_device.dart. (-0.50 points)

Analysis of lib/src/dlna_device.dart reported 1 hint:

line 95 col 10: Name non-constant identifiers using lowerCamelCase.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
connectivity ^0.4.8 0.4.9
flutter 0.0.0
shared_preferences ^0.5.6 0.5.8
xml2json ^4.2.0 4.3.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
connectivity_for_web 0.3.0
connectivity_macos 0.1.0+3
connectivity_platform_interface 1.0.6
convert 2.1.1
file 5.2.1
flutter_web_plugins 0.0.0
intl 0.16.1
js 0.6.2
meta 1.1.8 1.2.2
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_platform_interface 1.0.2
petitparser 3.0.4
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
shared_preferences_linux 0.0.2+1
shared_preferences_macos 0.0.1+10
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
xml 4.2.0
Dev dependencies
flutter_test