diff --git a/packages/video_player_avplay/CHANGELOG.md b/packages/video_player_avplay/CHANGELOG.md index 152a2a61d..5a247900a 100644 --- a/packages/video_player_avplay/CHANGELOG.md +++ b/packages/video_player_avplay/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.7 + +* Fix black line issue when playing video. + ## 0.7.6 * Fix video doesn't scale issue. diff --git a/packages/video_player_avplay/README.md b/packages/video_player_avplay/README.md index cd24b0698..c500b57ce 100644 --- a/packages/video_player_avplay/README.md +++ b/packages/video_player_avplay/README.md @@ -12,7 +12,7 @@ To use this package, add `video_player_avplay` as a dependency in your `pubspec. ```yaml dependencies: - video_player_avplay: ^0.7.6 + video_player_avplay: ^0.7.7 ``` Then you can import `video_player_avplay` in your Dart code: diff --git a/packages/video_player_avplay/lib/video_player.dart b/packages/video_player_avplay/lib/video_player.dart index b0c28231e..f3460143c 100644 --- a/packages/video_player_avplay/lib/video_player.dart +++ b/packages/video_player_avplay/lib/video_player.dart @@ -1246,26 +1246,29 @@ class _VideoPlayerState extends State { WidgetsBinding.instance.addPostFrameCallback(_afterFrameLayout); } + bool _isInvalid(double value) { + return value.isInfinite || value.isNaN; + } + void _afterFrameLayout(_) { if (widget.controller.value.isInitialized) { - final Rect currentRect = _getCurrentRect(); - if (currentRect != Rect.zero && _playerRect != currentRect) { + final Rect rect = _getCurrentRect(); + if (rect != Rect.zero && _playerRect != rect) { + final double offsetLeft = rect.left - rect.left.floor(); + final double offsetTop = rect.top - rect.top.floor(); + final double offsetWidth = rect.width.ceil() - rect.width; + final double offsetHeight = rect.height.ceil() - rect.height; + final int left = _isInvalid(rect.left) ? 0 : rect.left.floor(); + final int top = _isInvalid(rect.top) ? 0 : rect.top.floor(); + final int width = _isInvalid(rect.width) + ? 1 + : rect.width.ceil() + ((offsetLeft > offsetWidth) ? 1 : 0); + final int height = _isInvalid(rect.height) + ? 1 + : rect.height.ceil() + ((offsetTop > offsetHeight) ? 1 : 0); _videoPlayerPlatform.setDisplayGeometry( - _playerId, - (currentRect.left.isInfinite || currentRect.left.isNaN) - ? 0 - : currentRect.left.toInt(), - (currentRect.top.isInfinite || currentRect.top.isNaN) - ? 0 - : currentRect.top.toInt(), - (currentRect.width.isInfinite || currentRect.width.isNaN) - ? 1 - : currentRect.width.toInt(), - (currentRect.height.isInfinite || currentRect.height.isNaN) - ? 1 - : currentRect.height.toInt(), - ); - _playerRect = currentRect; + _playerId, left, top, width, height); + _playerRect = rect; } } WidgetsBinding.instance.addPostFrameCallback(_afterFrameLayout); diff --git a/packages/video_player_avplay/pubspec.yaml b/packages/video_player_avplay/pubspec.yaml index 1dc3cd722..49911af41 100644 --- a/packages/video_player_avplay/pubspec.yaml +++ b/packages/video_player_avplay/pubspec.yaml @@ -2,7 +2,7 @@ name: video_player_avplay description: Flutter plugin for displaying inline video on Tizen TV devices. homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player_avplay -version: 0.7.6 +version: 0.7.7 environment: sdk: ">=3.1.0 <4.0.0"