Skip to content

Queue shows 0:00: YouTubeEngine passes duration in seconds but SpotubeAudioSourceMatchObject expects microseconds #3021

@jablonowskit

Description

@jablonowskit

Is there an existing issue for this? (Please read the description)

  • I have searched the existing issues

Current Behavior

Related

  • Possibly same UI symptom as Media Duration #782 (0:00 in queue), but this report is a different root cause (audio-source match JSON units, not queue/track JSON persistence).

Summary

Plugin audio source receives duration from MetadataPlugin.create()YouTubeEngine callbacks. That value is passed through Hetu plugins as SpotubeAudioSourceMatchObject JSON.
SpotubeAudioSourceMatchObject.fromJson interprets duration as microseconds (Duration(microseconds: json['duration'])).
The engine currently sets 'duration': video.duration?.inSeconds, i.e. seconds (e.g. 210 for 3:30). That becomes Duration(microseconds: 210) ≈ 0 → displayed as 0:00 in the queue when UI uses sourced match duration.

Where

lib/services/metadata/metadata.dart — inside createYoutubeEngine / YouTubeEngine callbacks:

  • search map: 'duration': video.duration?.inSeconds
  • getVideo map: 'duration': video.duration?.inSeconds

Suggested fix

Use microseconds to match JSON contract:

'duration': video.duration?.inMicroseconds,

### Expected Behavior

// metadata.dart — both search() and getVideo() callbacks:
'duration': video.duration?.inMicroseconds,  // ✓ microseconds
Affected: All audio source plugins using yt.search() / yt.getVideo() (YouTube Audio, NewPipe, etc.) — TrackTile duration in PlayerQueue always shows 0:00 for sourced tracks.

### Steps to reproduce

1. Install / launch Spotube (Windows is fine).
2. Set the audio source to the YouTube plugin or NewPipe (any engine backed by YouTubeEngine).
3. Sign in to metadata (e.g. Spotify plugin) and enqueue a playlist/album, or use tracks where the UI relies on sourced duration / shows missing duration.
4. Open the playback queue (queued tracks list).
5. Observe: the duration column for tracks shows 0:00 (or effectively zero), even though playback works and the matched video has a real length.

### Logs

not needed

### Operating System

Android

### Spotube version

v5.1.1 build 44

### Installation source

Website (spotube.krtirtho.dev), F-Droid (Android)

### Additional information

_No response_

### Self grab

- [X] I'm ready to work on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions