Skip to content

Commit

Permalink
[video_player_videohole] Fix getAudioTracks out of bounds issue (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan authored Sep 24, 2024
1 parent 36e0966 commit 6487704
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 26 deletions.
3 changes: 2 additions & 1 deletion packages/video_player_videohole/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## NEXT
## 0.5.2

* Fix new lint warnings.
* Update minimum Flutter and Dart version to 3.13 and 3.1.
* Fix getAudioTracks out of bounds issue.

## 0.5.1

Expand Down
2 changes: 1 addition & 1 deletion packages/video_player_videohole/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use this package, add `video_player_videohole` as a dependency in your `pubsp

```yaml
dependencies:
video_player_videohole: ^0.5.1
video_player_videohole: ^0.5.2
```
Then you can import `video_player_videohole` in your Dart code:
Expand Down
14 changes: 1 addition & 13 deletions packages/video_player_videohole/lib/src/tracks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ enum TrackType {
text,
}

/// Type of the track audio channel for [TrackType.audio].
enum AudioTrackChannelType {
/// The mono channel.
mono,

/// The stereo channel.
stereo,

/// The surround channel.
surround,
}

/// Type of the track subtitle type for [TrackType.text].
enum TextTrackSubtitleType {
/// The text subtitle.
Expand Down Expand Up @@ -99,7 +87,7 @@ class AudioTrack extends Track {
final String language;

/// The channel of audio track.
final AudioTrackChannelType channel;
final int channel;

/// The bitrate of audio track.
final int bitrate;
Expand Down
12 changes: 2 additions & 10 deletions packages/video_player_videohole/lib/src/video_player_tizen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,13 @@ class VideoPlayerTizen extends VideoPlayerPlatform {
for (final Map<Object?, Object?>? trackMap in response.tracks) {
final int trackId = trackMap!['trackId']! as int;
final String language = trackMap['language']! as String;
final AudioTrackChannelType channelType =
_intChannelTypeMap[trackMap['channel']]!;
final int channel = trackMap['channel']! as int;
final int bitrate = trackMap['bitrate']! as int;

audioTracks.add(AudioTrack(
trackId: trackId,
language: language,
channel: channelType,
channel: channel,
bitrate: bitrate,
));
}
Expand Down Expand Up @@ -274,11 +273,4 @@ class VideoPlayerTizen extends VideoPlayerPlatform {
VideoFormat.dash: 'dash',
VideoFormat.other: 'other',
};

static const Map<int, AudioTrackChannelType> _intChannelTypeMap =
<int, AudioTrackChannelType>{
1: AudioTrackChannelType.mono,
2: AudioTrackChannelType.stereo,
3: AudioTrackChannelType.surround,
};
}
2 changes: 1 addition & 1 deletion packages/video_player_videohole/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: video_player_videohole
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_videohole
version: 0.5.1
version: 0.5.2

environment:
sdk: ">=3.1.0 <4.0.0"
Expand Down

0 comments on commit 6487704

Please sign in to comment.