calzoneman / sync

Node.JS Server and JavaScript/HTML Client for synchronizing online media
Other
1.45k stars 235 forks source link

Support enabling custom media subtitle by default #889

Closed animeavi closed 3 years ago

animeavi commented 3 years ago

If there's a cleaner way to do the CoffeeScript code instead of copying every attribute twice, let me know. Tested locally and works as intended.

animeavi commented 3 years ago

My thinking with this was like, you're watching some French video with English softsubs, instead of telling everyone to enable the subtitles, you could do it by default, I only tested by setting one subtitle to default so far. I'll see about making the changes and more testing in a bit.

animeavi commented 3 years ago

Made most changes and added some basic validation. For handling multiple defaults (if they exist) I was thinking of adding something like a default_count here and only allowing the attribute to be set if it's 0. What do you think?

From my tests, if multiple tracks are set to default, the topmost one gets priority.

calzoneman commented 3 years ago

My thinking with this was like, you're watching some French video with English softsubs, instead of telling everyone to enable the subtitles, you could do it by default

Hmm. I generally prefer to keep the default experience very plain and allow users to opt-in to whatever they'd like. I do think it would be reasonable to have the player remember that subtitles were enabled, as a convenience so that the user doesn't have to continually select it every time a new video is played.

However, if you're having to tell people to enable subtitles, perhaps the problem is really that the player doesn't make it obvious that subtitles are available.

For handling multiple defaults (if they exist) I was thinking of adding something like a default_count here and only allowing the attribute to be set if it's 0. What do you think?

I would prefer if the server just prevented you from adding multiple defaults in the same manifest.

animeavi commented 3 years ago

Well it can be done in the validator the same way, I'll look for a way that doesn't look too messy.

animeavi commented 3 years ago

How does that look, @calzoneman?