Skip to content

Add audio track methods to sdk#1123

Merged
brandonhrowe merged 9 commits intomasterfrom
add-audio-methods
Oct 20, 2025
Merged

Add audio track methods to sdk#1123
brandonhrowe merged 9 commits intomasterfrom
add-audio-methods

Conversation

@brandonhrowe
Copy link
Contributor

This PR adds support for audio track methods on the player SDK.

@brandonhrowe brandonhrowe marked this pull request as draft October 9, 2025 14:12
@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.16%. Comparing base (5e478b6) to head (f22e733).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1123      +/-   ##
==========================================
+ Coverage   73.87%   74.16%   +0.28%     
==========================================
  Files           7        7              
  Lines         624      631       +7     
==========================================
+ Hits          461      468       +7     
  Misses        163      163              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@brandonhrowe brandonhrowe marked this pull request as ready for review October 9, 2025 15:35
README.md Outdated
}
```

Kind can be any of the following: "main", "translation", "descriptions", or "commentary".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also specify what the provenance values could be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to include those values as well.

* @throws {InvalidParameterError} If no track was available with the specified language
* @throws {InvalidTrackError} If no track was available with the specified language and kind
*/
enableAudioTrack(language: string, kind?: string): Promise<VimeoAudioTrack>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we provide specific types for kind and VimeoAudioTrack?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Added types for AudioKind, AudioProvenance, AudioLanguage (just a string, but includes more descriptions for ISO codes), and VimeoAudioTrack that includes all of the above.

* @throws {InvalidParameterError} If no track was available with the specified language
* @throws {InvalidTrackError} If no track was available with the specified language and kind
*/
enableAudioTrack(language: string, kind?: string): Promise<VimeoAudioTrack>;
Copy link
Contributor

@jdreetz jdreetz Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we document language and kind more thoroughly? We should give more examples of what they can be and where you can find the available options in the player or Vimeo.com.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added AudioLanguage and AudioKind types that include more descriptions/links for both of them, and a union for the kinds to specify the options.

src/player.js Outdated
/**
* A representation of an audio track on a video.
*
* @typedef {Object} VimeoAudioTrack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we import the typescript type for this, instead of defining it twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

README.md Outdated
- [getTextTracks(): Promise<object[], Error>](#gettexttracks-promiseobject-error)
- [getAudioTracks(): Promise<object[], Error>](#getaudiotracks-promiseobject-error)
- [getEnabledAudioTrack(): Promise<object[], Error>](#getenabledaudiotrack-promiseobject-error)
- [getMainAudioTrack(): Promise<object[], Error>](#getmainaudiotrack-promiseobject-error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still want to call this Main if we're referring to it as default in the setter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated, and will make the change internally


getAudioTracks(): Promise<VimeoAudioTrack[]>;
getEnabledAudioTrack(): Promise<VimeoAudioTrack | undefined>;
getMainAudioTrack(): Promise<VimeoAudioTrack | undefined>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still want to call this Main if we're referring to it as default in the setter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

src/player.js Outdated
Comment on lines 473 to 474
* @param {string} language The two‐letter language code.
* @param {string} [kind] The kind of track to enable (main, translation, descriptions, commentary).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also import the aliases (AudioLanguage and AudioKind) for these, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

@jdreetz jdreetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brandonhrowe brandonhrowe merged commit 83846f4 into master Oct 20, 2025
4 checks passed
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.

3 participants