Skip to content

Have updateFormat return MediaFormat#147

Merged
Inrixia merged 3 commits intoInrixia:masterfrom
squadgazzz:update-format-return-type
Mar 4, 2026
Merged

Have updateFormat return MediaFormat#147
Inrixia merged 3 commits intoInrixia:masterfrom
squadgazzz:update-format-return-type

Conversation

@squadgazzz
Copy link
Copy Markdown
Contributor

Summary

  • updateFormat now returns MediaFormat | undefined instead of void, allowing callers to directly access the format data without needing to use the withFormat callback pattern

Motivation

Currently, the only way to access format data (bitDepth, sampleRate, etc.) after calling updateFormat is through the withFormat listener/callback pattern. This forces callers to wrap the call in a Promise with withFormat just to get the result - e.g. in Inrixia/luna-plugins#222 where we need to log format info.

With this change, callers can simply do:

const format = await mediaItem.updateFormat(quality.audioQuality);
if (format?.bitDepth && format?.sampleRate) {
      // use format directly
}

Details

  • Fully backwards-compatible - existing callers that ignore the return value are unaffected
  • Returns format on cache hit, undefined when no playback info is available

@Inrixia
Copy link
Copy Markdown
Owner

Inrixia commented Mar 4, 2026

Could you please add a commit to bump client patch version.

As soon as that's done I'll merge this 💜

@squadgazzz
Copy link
Copy Markdown
Contributor Author

@Inrixia , done 🙌

@Inrixia Inrixia merged commit dfaa486 into Inrixia:master Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants