Skip to content

Conversation

@jakub-roch
Copy link
Contributor

@jakub-roch jakub-roch commented Aug 25, 2025

Source switcher

image

@jakub-roch jakub-roch requested a review from a team as a code owner August 25, 2025 07:27
@netlify
Copy link

netlify bot commented Aug 25, 2025

Deploy Preview for cld-vp-esm-pages ready!

Name Link
🔨 Latest commit b254d5f
🔍 Latest deploy log https://app.netlify.com/projects/cld-vp-esm-pages/deploys/68b571b16ae6e900089d2688
😎 Deploy Preview https://deploy-preview-904--cld-vp-esm-pages.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Aug 25, 2025

Deploy Preview for cld-video-player ready!

Name Link
🔨 Latest commit b254d5f
🔍 Latest deploy log https://app.netlify.com/projects/cld-video-player/deploys/68b571b16f7f31000870a810
😎 Deploy Preview https://deploy-preview-904--cld-video-player.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +32 to +38
const empty = new MenuItem(this.player_, {
label: this._emptyLabel || 'No sources',
selectable: false
});
empty.addClass('vjs-source-switcher-empty');
empty.disable();
return [empty];
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have an "empty" state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

initially this component is mounted without any source, just to avoid complex implementation and just after that it gets list of sources provided as player params (so its the part of player, it should never be visible but just in case empty state is added rather than nothing)

@tsi
Copy link
Collaborator

tsi commented Aug 26, 2025

@jakub-roch how will this play together with a publicId configuration? or with a player using the source(...) method? will I be able to pass an array to source()?

@jakub-roch
Copy link
Contributor Author

jakub-roch commented Aug 27, 2025

@jakub-roch how will this play together with a publicId configuration? or with a player using the source(...) method? will I be able to pass an array to source()?

@tsi for now we dont really care about any incorrect usage (like blocking other methods when source is being used), user can provide publicId but it will be ignored and first item of videoSources list will be used

I confirmed with Raz that we will handle all the issues reported by users once they occur as for now it will too many stuff that we would to need to mape to prevent "incorrect" usage

@tsi
Copy link
Collaborator

tsi commented Aug 27, 2025

dont really care about any incorrect usage

@jakub-roch why using the source() method to switch videos is incorrect? how about using these alternate-sources in a playlist?

Also, please add this to internal analytics

@jakub-roch
Copy link
Contributor Author

jakub-roch commented Aug 28, 2025

dont really care about any incorrect usage

@jakub-roch why using the source() method to switch videos is incorrect? how about using these alternate-sources in a playlist?

Also, please add this to internal analytics

@tsi We need to think about that as its the same question of - whats the point of using source() when playlist is provided?
For now just simple use case - at init. If we notice any other issues or missing functionalities reported by users (like source method with multiple sources) - I believe it will be the best moment to cover it.

Thanks for reminder about internal analytics!

Copy link
Collaborator

@tsi tsi left a comment

Choose a reason for hiding this comment

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

Looks and works great! 💪
https://codepen.io/tsi/pen/qEOyQGr

});
}

setItems(items, keepSelection = true) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why keepSelection defaults to false if its only usage needs false? looks like this can be simplified

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 point 👍 I fixed it

<li><a href="./seek-thumbs.html">Seek Thumbnails</a></li>
<li><a href="./share-plugin.html">Share &amp; Download</a></li>
<li><a href="./shoppable.html">Shoppable Videos</a></li>
<li><a href="./source-switcher.html">Source switcher</a></li>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also add an ESM example page? I'm ok with not having everything doubled, just that this is what we did with other examples

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we dont have yet E2E test for this page (just mocked for now) but I believe ESM should be added only if there is a reason for that (otherwise we are doubling everything), for now I will keep just one page but we need to decide about some rules here (will schedule meeting for us after gathering)

},
playerOptions: {
debug: validator.isBoolean,
videoSources: validator.isArray,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move to sourceValidators?

withCredentials: playerOptions.withCredentials,
debug: playerOptions.debug,
type: playerOptions.type,
videoSources: !!playerOptions.videoSources,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move to getSourceOptions?

@jakub-roch jakub-roch merged commit c77e1f8 into master Sep 2, 2025
10 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.

4 participants