mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
16
lib/util/player_extensions.dart
Normal file
16
lib/util/player_extensions.dart
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:fladder/models/items/media_streams_model.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
extension PlayerExtensions on Player {
|
||||
Future<void> addSubtitles(List<SubStreamModel> subtitles) async {
|
||||
final separator = Platform.isWindows ? ";" : ":";
|
||||
await (platform as NativePlayer).setProperty(
|
||||
"sub-files",
|
||||
subtitles
|
||||
.mapIndexed((index, e) => "${Platform.isWindows ? e.url : e.url?.replaceFirst(":", "\\:")}@${e.displayTitle}")
|
||||
.join(separator),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue