Skip to content

Commit a8b3cb7

Browse files
authored
[video_player_avplay] Fix black line issue when playing the video (#942)
1 parent 24ec131 commit a8b3cb7

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

packages/video_player_avplay/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.7
2+
3+
* Fix black line issue when playing video.
4+
15
## 0.7.6
26
* Fix video doesn't scale issue.
37

packages/video_player_avplay/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To use this package, add `video_player_avplay` as a dependency in your `pubspec.
1212

1313
```yaml
1414
dependencies:
15-
video_player_avplay: ^0.7.6
15+
video_player_avplay: ^0.7.7
1616
```
1717
1818
Then you can import `video_player_avplay` in your Dart code:

packages/video_player_avplay/lib/video_player.dart

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,26 +1246,29 @@ class _VideoPlayerState extends State<VideoPlayer> {
12461246
WidgetsBinding.instance.addPostFrameCallback(_afterFrameLayout);
12471247
}
12481248

1249+
bool _isInvalid(double value) {
1250+
return value.isInfinite || value.isNaN;
1251+
}
1252+
12491253
void _afterFrameLayout(_) {
12501254
if (widget.controller.value.isInitialized) {
1251-
final Rect currentRect = _getCurrentRect();
1252-
if (currentRect != Rect.zero && _playerRect != currentRect) {
1255+
final Rect rect = _getCurrentRect();
1256+
if (rect != Rect.zero && _playerRect != rect) {
1257+
final double offsetLeft = rect.left - rect.left.floor();
1258+
final double offsetTop = rect.top - rect.top.floor();
1259+
final double offsetWidth = rect.width.ceil() - rect.width;
1260+
final double offsetHeight = rect.height.ceil() - rect.height;
1261+
final int left = _isInvalid(rect.left) ? 0 : rect.left.floor();
1262+
final int top = _isInvalid(rect.top) ? 0 : rect.top.floor();
1263+
final int width = _isInvalid(rect.width)
1264+
? 1
1265+
: rect.width.ceil() + ((offsetLeft > offsetWidth) ? 1 : 0);
1266+
final int height = _isInvalid(rect.height)
1267+
? 1
1268+
: rect.height.ceil() + ((offsetTop > offsetHeight) ? 1 : 0);
12531269
_videoPlayerPlatform.setDisplayGeometry(
1254-
_playerId,
1255-
(currentRect.left.isInfinite || currentRect.left.isNaN)
1256-
? 0
1257-
: currentRect.left.toInt(),
1258-
(currentRect.top.isInfinite || currentRect.top.isNaN)
1259-
? 0
1260-
: currentRect.top.toInt(),
1261-
(currentRect.width.isInfinite || currentRect.width.isNaN)
1262-
? 1
1263-
: currentRect.width.toInt(),
1264-
(currentRect.height.isInfinite || currentRect.height.isNaN)
1265-
? 1
1266-
: currentRect.height.toInt(),
1267-
);
1268-
_playerRect = currentRect;
1270+
_playerId, left, top, width, height);
1271+
_playerRect = rect;
12691272
}
12701273
}
12711274
WidgetsBinding.instance.addPostFrameCallback(_afterFrameLayout);

packages/video_player_avplay/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: video_player_avplay
22
description: Flutter plugin for displaying inline video on Tizen TV devices.
33
homepage: https://github.com/flutter-tizen/plugins
44
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player_avplay
5-
version: 0.7.6
5+
version: 0.7.7
66

77
environment:
88
sdk: ">=3.1.0 <4.0.0"

0 commit comments

Comments
 (0)