File tree Expand file tree Collapse file tree 4 files changed +24
-6
lines changed
packages/video_player/video_player_avfoundation Expand file tree Collapse file tree 4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 1
- ## NEXT
1
+ ## 2.4.7
2
2
3
3
* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18.
4
+ * Adds iOS exception on incorrect asset path
4
5
5
6
## 2.4.6
6
7
Original file line number Diff line number Diff line change @@ -620,10 +620,15 @@ - (FLTTextureMessage *)create:(FLTCreateMessage *)input error:(FlutterError **)e
620
620
} else {
621
621
assetPath = [_registrar lookupKeyForAsset: input.asset];
622
622
}
623
- player = [[FLTVideoPlayer alloc ] initWithAsset: assetPath
624
- frameUpdater: frameUpdater
625
- playerFactory: _playerFactory];
626
- return [self onPlayerSetup: player frameUpdater: frameUpdater];
623
+ @try {
624
+ player = [[FLTVideoPlayer alloc ] initWithAsset: assetPath
625
+ frameUpdater: frameUpdater
626
+ playerFactory: _playerFactory];
627
+ return [self onPlayerSetup: player frameUpdater: frameUpdater];
628
+ } @catch (NSException *exception) {
629
+ *error = [FlutterError errorWithCode: @" video_player" message: exception.reason details: nil ];
630
+ return nil ;
631
+ }
627
632
} else if (input.uri ) {
628
633
player = [[FLTVideoPlayer alloc ] initWithURL: [NSURL URLWithString: input.uri]
629
634
frameUpdater: frameUpdater
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: video_player_avfoundation
2
2
description : iOS implementation of the video_player plugin.
3
3
repository : https://github.com/flutter/packages/tree/main/packages/video_player/video_player_avfoundation
4
4
issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
5
- version : 2.4.6
5
+ version : 2.4.7
6
6
7
7
environment :
8
8
sdk : " >=2.18.0 <4.0.0"
Original file line number Diff line number Diff line change @@ -135,6 +135,18 @@ void main() {
135
135
expect (textureId, 3 );
136
136
});
137
137
138
+ test ('create with incorrect asset throws exception' , () async {
139
+ try {
140
+ await player.create (DataSource (
141
+ sourceType: DataSourceType .asset,
142
+ asset: '/path/to/incorrect_asset' ,
143
+ ));
144
+ fail ('should throw PlatformException' );
145
+ } catch (e) {
146
+ expect (e, isException);
147
+ }
148
+ });
149
+
138
150
test ('create with network' , () async {
139
151
final int ? textureId = await player.create (DataSource (
140
152
sourceType: DataSourceType .network,
You can’t perform that action at this time.
0 commit comments