setDrmConfig method
Future<void>
setDrmConfig({
- required String videoUrl,
- required String licenseUrl,
- String? signingKey,
- String? edgeName,
- String? token,
- String? kid,
- double? width,
- double? height,
- String? alignment,
- String? certificateUrl,
- String? nonceUrl,
- String? jwt,
- int startPositionMs = 0,
- bool flutterOwnsFullscreen = false,
- BmdrmDrawerToggle drawerToggle = const BmdrmDrawerToggle(),
Implementation
Future<void> setDrmConfig({
required String videoUrl,
required String licenseUrl,
String? signingKey,
String? edgeName,
String? token,
String? kid,
double? width,
double? height,
String? alignment,
String? certificateUrl,
String? nonceUrl,
String? jwt,
int startPositionMs = 0,
bool flutterOwnsFullscreen = false,
BmdrmDrawerToggle drawerToggle = const BmdrmDrawerToggle(),
}) async {
try {
_activeController = this;
if (!_handlerInitialized) {
_channel.setMethodCallHandler(_handleNativeMethodCall);
_handlerInitialized = true;
}
// Loading media always lands on Auto with no renditions known yet, and
// that has to hold on both platforms — a pinned id is a position in one
// stream's ladder and means nothing in another. Both natives now reset
// themselves on load (iOS at the top of `configureDrmAndPlay`, Android
// when it rebuilds the ExoPlayer), so this is belt-and-braces: it is what
// publishes the empty list to a host-drawn picker, which would otherwise
// keep offering the previous stream's rows until the new manifest parses.
_onVideoQualitiesChanged?.call(const [], -1);
await setVideoQuality(-1);
await _channel.invokeMethod('setDrmConfig', {
'videoUrl': videoUrl,
'licenseUrl': licenseUrl,
'signingKey': signingKey,
'edgeName': edgeName,
'token': token,
'kid': kid,
'width': width,
'height': height,
'alignment': alignment,
'certificateUrl': certificateUrl,
'nonceUrl': nonceUrl,
'jwt': jwt,
'startPositionMs': startPositionMs,
'flutterOwnsFullscreen': flutterOwnsFullscreen,
'drawerToggleVisible': drawerToggle.visible,
'drawerToggleLabel': drawerToggle.label,
'drawerToggleColor': drawerToggle.color?.toARGB32(),
'drawerToggleTextColor': drawerToggle.textColor?.toARGB32(),
});
} catch (e) {
_onError?.call('Failed to set DRM config: $e');
}
}