File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed
packages/video_player/video_player_avfoundation
video_player_avfoundation/Sources/video_player_avfoundation Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ ## 2.6.5
2+
3+ * Bugfix to allow the audio-only HLS (.m3u8) on iOS.
4+
15## 2.6.4
26
37* Refactors native code structure.
Original file line number Diff line number Diff line change @@ -530,6 +530,22 @@ - (void)testHLSControls {
530530 XCTAssertEqualWithAccuracy ([videoInitialization[@" duration" ] intValue ], 4000 , 200 );
531531}
532532
533+ - (void )testAudioOnlyHLSControls {
534+ NSObject <FlutterPluginRegistrar> *registrar =
535+ [GetPluginRegistry () registrarForPlugin: @" TestAudioOnlyHLSControls" ];
536+
537+ FVPVideoPlayerPlugin *videoPlayerPlugin =
538+ (FVPVideoPlayerPlugin *)[[FVPVideoPlayerPlugin alloc ] initWithRegistrar: registrar];
539+
540+ NSDictionary <NSString *, id > *videoInitialization =
541+ [self testPlugin: videoPlayerPlugin
542+ uri: @" https://flutter.github.io/assets-for-api-docs/assets/videos/hls/"
543+ @" bee_audio_only.m3u8" ];
544+ XCTAssertEqualObjects (videoInitialization[@" height" ], @0 );
545+ XCTAssertEqualObjects (videoInitialization[@" width" ], @0 );
546+ XCTAssertEqualWithAccuracy ([videoInitialization[@" duration" ] intValue ], 4000 , 200 );
547+ }
548+
533549#if TARGET_OS_IOS
534550- (void )testTransformFix {
535551 [self validateTransformFixForOrientation: UIImageOrientationUp];
Original file line number Diff line number Diff line change @@ -383,7 +383,9 @@ - (void)setupEventSinkIfReadyToPlay {
383383 }
384384
385385 BOOL hasVideoTracks = [asset tracksWithMediaType: AVMediaTypeVideo].count != 0 ;
386- BOOL hasNoTracks = asset.tracks .count == 0 ;
386+ // Audio-only HLS files have no size, so `currentItem.tracks.count` must be used to check for
387+ // track presence, as AVAsset does not always provide track information in HLS streams.
388+ BOOL hasNoTracks = currentItem.tracks .count == 0 && asset.tracks .count == 0 ;
387389
388390 // The player has not yet initialized when it has no size, unless it is an audio-only track.
389391 // HLS m3u8 video files never load any tracks, and are also not yet initialized until they have
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: video_player_avfoundation
22description : iOS and macOS implementation of the video_player plugin.
33repository : https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
5- version : 2.6.4
5+ version : 2.6.5
66
77environment :
88 sdk : ^3.3.0
You can’t perform that action at this time.
0 commit comments