Simple DLNA

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

Structure

structure

Example

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" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.WAKE_LOCK" />
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Import

import 'package:simple_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 widget.dlnaManager.actSetVideoUrl(_didlObject);

Release server

dlnaManager.release();

Search Cache function

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

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

Libraries

simple_dlna