Skip to content

Conversation

@yoriiis
Copy link
Member

@yoriiis yoriiis commented Nov 19, 2025

Initial PR #153

cc/ @rtritto

@yoriiis yoriiis self-assigned this Nov 19, 2025
@vercel
Copy link

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
vlite Ready Ready Preview Nov 19, 2025 0:31am

| `getDuration()` | - | `Promise` | Get the duration |
| `mute()` | - | - | Mute the volume |
| `unMute()` | - | - | Unmute the volume |
| `setSource(source)` | `String` | - | Set the new media source |
Copy link
Member Author

Choose a reason for hiding this comment

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

Add parameter value info

| `getDuration()` | - | `Promise` | Get the duration |
| `mute()` | - | - | Mute the volume |
| `unMute()` | - | - | Unmute the volume |
| `setSource(source)` | `String` | - | Set the new media source |
Copy link
Member Author

Choose a reason for hiding this comment

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

Add note about to play trigger by this method

@yoriiis yoriiis linked an issue Nov 19, 2025 that may be closed by this pull request
@rtritto
Copy link
Contributor

rtritto commented Nov 19, 2025

@yoriiis Thanks, what about to call the setSource method like src (equal to video.js, short and preferred to have less migrations impacts)?

@yoriiis
Copy link
Member Author

yoriiis commented Nov 19, 2025

@yoriiis Thanks, what about to call the setSource method like src (equal to video.js, short and preferred to have less migrations impacts)?

It's a new method, so I don't really see how it limits migration.

In my opinion, src does not refer to a method. I prefer to keep the nomenclature used for other methods (getter/setter), which I find clearer.

@yoriiis
Copy link
Member Author

yoriiis commented Nov 19, 2025

@rtritto Could you test this feature? Since you were the one who requested it.
It is available on all providers

@rtritto
Copy link
Contributor

rtritto commented Nov 19, 2025

It's a new method, so I don't really see how it limits migration.

Having different method names the migration from video.js to vLite is:

- videoRef.src(newSrc)
+ videoRef.setSource(newSrc)

It's not a limit, but if both methods have same name, you have 1 less reference to migrate.

Another advantage is that src is shorter, so less characters are used (less code size).


In my opinion, src does not refer to a method. I prefer to keep the nomenclature used for other methods (getter/setter), which I find clearer.

What do you think about, in another PR, the logic of all methods of the getter/setter can be improved.
E.g. for source:

  • getter: playerRef.src
  • setter: playerRef.src(newSrc)

@rtritto Could you test this feature?

Yes

@rtritto
Copy link
Contributor

rtritto commented Nov 19, 2025

@yoriiis I can't test, I got cross-origin ~ header CORS “Access-Control-Allow-Origin” ~ 301 on "https://yoriiis.github.io/cdn/static/vlitejs/demo-video-html5.mp4".

@yoriiis
Copy link
Member Author

yoriiis commented Nov 20, 2025

@rtritto I'm happy you planned to migrate from Video.js to vLitejs!

I understand your point about migration, but I prefer to stick to my own terminology, which I find clearer. And, the goal of this library is not to be identical to video.js

@yoriiis
Copy link
Member Author

yoriiis commented Nov 20, 2025

@yoriiis I can't test, I got cross-origin ~ header CORS “Access-Control-Allow-Origin” ~ 301 on "https://yoriiis.github.io/cdn/static/vlitejs/demo-video-html5.mp4".

You can access the Vercel preview URL?

The error appears when you submit a new source?

If you have the project in local perhaps? I will check the error soon

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.

Method to set source

3 participants