Skip to content

Commit

Permalink
Fix buffer npe and empty durations (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored May 15, 2024
1 parent 5c3e10b commit 2e995c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 7 additions & 9 deletions lib/src/common/audio_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ class AudioTile extends StatelessWidget {
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
audio.durationMs != null
? Duration(milliseconds: audio.durationMs!.toInt())
.formattedTime
: Duration.zero.formattedTime,
),
const SizedBox(
width: 10,
),
if (audio.audioType != AudioType.radio && audio.durationMs != null)
Padding(
padding: const EdgeInsets.only(right: 10),
child: Text(
Duration(milliseconds: audio.durationMs!.toInt()).formattedTime,
),
),
LikeButton(
selected: selected && isPlayerPlaying,
libraryModel: libraryModel,
Expand Down
6 changes: 4 additions & 2 deletions lib/src/player/view/player_track.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class PlayerTrack extends StatelessWidget with WatchItMixin {
trackShape: trackShape as SliderTrackShape,
trackHeight: bottomPlayer ? 4.0 : 4.0,
inactiveTrackColor: mainColor.withOpacity(0.2),
activeTrackColor: mainColor.withOpacity(0.9),
activeTrackColor: mainColor.withOpacity(0.85),
overlayColor: mainColor,
secondaryActiveTrackColor: mainColor.withOpacity(0.25),
),
Expand All @@ -95,7 +95,9 @@ class PlayerTrack extends StatelessWidget with WatchItMixin {
min: 0,
max: sliderActive ? duration.inSeconds.toDouble() : 1.0,
value: sliderActive ? position.inSeconds.toDouble() : 0,
secondaryTrackValue: secondaryTrackValue,
secondaryTrackValue: sliderActive && bufferActive
? secondaryTrackValue
: null,
onChanged: sliderActive
? (v) async {
setPosition(Duration(seconds: v.toInt()));
Expand Down

0 comments on commit 2e995c5

Please sign in to comment.