BetterPlayerDataSource class

Representation of data source which will be played in Better Player. Allows to setup all necessary configuration connected to video source.

Constructors

BetterPlayerDataSource(BetterPlayerDataSourceType type, String url, {List<int>? bytes, List<BetterPlayerSubtitlesSource>? subtitles, bool? liveStream = false, Map<String, String>? headers, bool? useAsmsSubtitles = true, bool? useAsmsTracks = true, bool? useAsmsAudioTracks = true, List<String>? asmsTrackNames, Map<String, String>? resolutions, BetterPlayerCacheConfiguration? cacheConfiguration, BetterPlayerNotificationConfiguration? notificationConfiguration = const BetterPlayerNotificationConfiguration(showNotification: false), Duration? overriddenDuration, BetterPlayerVideoFormat? videoFormat, String? videoExtension, BetterPlayerDrmConfiguration? drmConfiguration, Widget? placeholder, BetterPlayerBufferingConfiguration bufferingConfiguration = const BetterPlayerBufferingConfiguration()})
BetterPlayerDataSource.file(String url, {List<BetterPlayerSubtitlesSource>? subtitles, bool? useAsmsSubtitles, bool? useAsmsTracks, Map<String, String>? qualities, BetterPlayerCacheConfiguration? cacheConfiguration, BetterPlayerNotificationConfiguration? notificationConfiguration, Duration? overriddenDuration, Widget? placeholder})
Factory method to build file data source which uses url as data source. Bytes parameter is not used in this data source.
factory
BetterPlayerDataSource.memory(List<int> bytes, {String? videoExtension, List<BetterPlayerSubtitlesSource>? subtitles, bool? useAsmsSubtitles, bool? useAsmsTracks, Map<String, String>? qualities, BetterPlayerCacheConfiguration? cacheConfiguration, BetterPlayerNotificationConfiguration? notificationConfiguration, Duration? overriddenDuration, Widget? placeholder})
Factory method to build network data source which uses bytes as data source. Url parameter is not used in this data source.
factory
BetterPlayerDataSource.network(String url, {List<BetterPlayerSubtitlesSource>? subtitles, bool? liveStream, Map<String, String>? headers, bool? useAsmsSubtitles, bool? useAsmsTracks, bool? useAsmsAudioTracks, Map<String, String>? qualities, BetterPlayerCacheConfiguration? cacheConfiguration, BetterPlayerNotificationConfiguration notificationConfiguration = const BetterPlayerNotificationConfiguration(showNotification: false), Duration? overriddenDuration, BetterPlayerVideoFormat? videoFormat, BetterPlayerDrmConfiguration? drmConfiguration, Widget? placeholder, BetterPlayerBufferingConfiguration bufferingConfiguration = const BetterPlayerBufferingConfiguration()})
Factory method to build network data source which uses url as data source Bytes parameter is not used in this data source.
factory

Properties

asmsTrackNames List<String>?
List of strings that represents tracks names. If empty, then better player will choose name based on track parameters
final
bufferingConfiguration BetterPlayerBufferingConfiguration
Configuration of video buffering. Currently only supported in Android platform.
final
bytes List<int>?
List of bytes, used only in memory player
final
cacheConfiguration BetterPlayerCacheConfiguration?
Optional cache configuration, used only for network data sources
final
drmConfiguration BetterPlayerDrmConfiguration?
Configuration of content protection
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Custom headers for player
final
liveStream bool?
Flag to determine if current data source is live stream
final
notificationConfiguration BetterPlayerNotificationConfiguration?
Configuration of remote controls notification
final
overriddenDuration Duration?
Duration which will be returned instead of original duration
final
placeholder Widget?
Placeholder widget which will be shown until video load or play. This placeholder may be useful if you want to show placeholder before each video in playlist. Otherwise, you should use placeholder from BetterPlayerConfiguration.
final
resolutions Map<String, String>?
Optional, alternative resolutions for non-hls/dash video. Used to setup different qualities for video. Data should be in given format: {"360p": "url", "540p": "url2" }
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subtitles List<BetterPlayerSubtitlesSource>?
Subtitles configuration
final
type BetterPlayerDataSourceType
Type of source of video
final
url String
Url of the video
final
useAsmsAudioTracks bool?
Should player use hls /das audio tracks
final
useAsmsSubtitles bool?
Should player use hls / dash subtitles (ASMS - Adaptive Streaming Media Sources).
final
useAsmsTracks bool?
Should player use hls tracks
final
videoExtension String?
Extension of video without dot.
final
videoFormat BetterPlayerVideoFormat?
Video format hint when data source url has not valid extension.
final

Methods

copyWith({BetterPlayerDataSourceType? type, String? url, List<int>? bytes, List<BetterPlayerSubtitlesSource>? subtitles, bool? liveStream, Map<String, String>? headers, bool? useAsmsSubtitles, bool? useAsmsTracks, bool? useAsmsAudioTracks, Map<String, String>? resolutions, BetterPlayerCacheConfiguration? cacheConfiguration, BetterPlayerNotificationConfiguration? notificationConfiguration = const BetterPlayerNotificationConfiguration(showNotification: false), Duration? overriddenDuration, BetterPlayerVideoFormat? videoFormat, String? videoExtension, BetterPlayerDrmConfiguration? drmConfiguration, Widget? placeholder, BetterPlayerBufferingConfiguration? bufferingConfiguration = const BetterPlayerBufferingConfiguration()}) BetterPlayerDataSource
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited