This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +32
-6
lines changed
packages/video_player/video_player Expand file tree Collapse file tree 4 files changed +32
-6
lines changed Original file line number Diff line number Diff line change 1+ ## 2.1.8
2+
3+ * Refactor ` FLTCMTimeToMillis ` to support indefinite streams. Fixes [ #48670 ] ( https://github.com/flutter/flutter/issues/48670 ) .
4+
15## 2.1.7
26
37* Update exoplayer to 2.14.1, removing dependency on Bintray.
Original file line number Diff line number Diff line change @@ -77,6 +77,23 @@ void main() {
7777 skip: ! (kIsWeb || defaultTargetPlatform == TargetPlatform .android),
7878 );
7979
80+ testWidgets (
81+ 'live stream duration != 0' ,
82+ (WidgetTester tester) async {
83+ VideoPlayerController networkController = VideoPlayerController .network (
84+ 'https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8' ,
85+ );
86+ await networkController.initialize ();
87+
88+ expect (networkController.value.isInitialized, true );
89+ // Live streams should have either a positive duration or C.TIME_UNSET if the duration is unknown
90+ // See https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/Player.html#getDuration--
91+ expect (networkController.value.duration,
92+ (Duration duration) => duration != Duration .zero);
93+ },
94+ skip: (kIsWeb),
95+ );
96+
8097 testWidgets (
8198 'can be played' ,
8299 (WidgetTester tester) async {
Original file line number Diff line number Diff line change 1111#error Code Requires ARC.
1212#endif
1313
14- int64_t FLTCMTimeToMillis (CMTime time) {
15- if (time.timescale == 0 ) return 0 ;
16- return time.value * 1000 / time.timescale ;
17- }
18-
1914@interface FLTFrameUpdater : NSObject
2015@property (nonatomic ) int64_t textureId;
2116@property (nonatomic , weak , readonly ) NSObject <FlutterTextureRegistry>* registry;
@@ -107,6 +102,16 @@ - (void)itemDidPlayToEndTime:(NSNotification*)notification {
107102 }
108103}
109104
105+ const int64_t TIME_UNSET = -9223372036854775807 ;
106+
107+ static inline int64_t FLTCMTimeToMillis (CMTime time) {
108+ // When CMTIME_IS_INDEFINITE return a value that matches TIME_UNSET from ExoPlayer2 on Android.
109+ // Fixes https://github.com/flutter/flutter/issues/48670
110+ if (CMTIME_IS_INDEFINITE (time)) return TIME_UNSET;
111+ if (time.timescale == 0 ) return 0 ;
112+ return time.value * 1000 / time.timescale ;
113+ }
114+
110115static inline CGFloat radiansToDegrees (CGFloat radians) {
111116 // Input range [-pi, pi] or [-180, 180]
112117 CGFloat degrees = GLKMathRadiansToDegrees ((float )radians);
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ description: Flutter plugin for displaying inline video with other Flutter
33 widgets on Android, iOS, and web.
44repository : https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
55issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
6- version : 2.1.7
6+ version : 2.1.8
77
88environment :
99 sdk : " >=2.12.0 <3.0.0"
You can’t perform that action at this time.
0 commit comments