Skip to content

Commit

Permalink
Clear key DRM update
Browse files Browse the repository at this point in the history
  • Loading branch information
jhomlala committed Aug 15, 2021
1 parent a1df6bb commit 45eb10d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Fixed progress bar issue where position could be set above video duration.
* Fixed iOS remote notification command issue.
* Removed duplicated page in example app (by https://github.com/pinguluk)
* Added support for clear key DRM (by https://github.com/tinusneethling)

## 0.0.72
* Updated ExoPlayer version
Expand Down
2 changes: 1 addition & 1 deletion docs/drmconfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ BetterPlayerDataSource _fairplayDataSource = BetterPlayerDataSource(
);
```

ClearKey:
ClearKey (only supported in Android):

A ClearKey MP4 file can be generated with MP4Box as follow:

Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/clearkey_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class _ClearKeyState extends State<ClearKeyPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("ClearKey player"),
title: Text("ClearKey DRM"),
),
body: SingleChildScrollView(
child: Column(
Expand Down
6 changes: 3 additions & 3 deletions example/lib/pages/welcome_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ class _WelcomePageState extends State<WelcomePage> {
_buildExampleElementWidget("DRM", () {
_navigateToPage(DrmPage());
}),
_buildExampleElementWidget("ClearKey DRM", () {
_navigateToPage(ClearKeyPage());
}),
_buildExampleElementWidget("DASH", () {
_navigateToPage(DashPage());
}),
_buildExampleElementWidget("ClearKey", () {
_navigateToPage(ClearKeyPage());
}),
];
}

Expand Down
15 changes: 12 additions & 3 deletions lib/src/controls/better_player_material_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,22 @@ class _ProgressBarPainter extends CustomPainter {
if (!value.initialized) {
return;
}
final double playedPartPercent =
double playedPartPercent =
value.position.inMilliseconds / value.duration!.inMilliseconds;
if (playedPartPercent.isNaN){
playedPartPercent = 0;
}
final double playedPart =
playedPartPercent > 1 ? size.width : playedPartPercent * size.width;
for (final DurationRange range in value.buffered) {
final double start = range.startFraction(value.duration!) * size.width;
final double end = range.endFraction(value.duration!) * size.width;
double start = range.startFraction(value.duration!) * size.width;
if (start.isNaN){
start = 0;
}
double end = range.endFraction(value.duration!) * size.width;
if (end.isNaN){
end = 0;
}
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromPoints(
Expand Down

0 comments on commit 45eb10d

Please sign in to comment.