Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: first pass of playback refactoring #1866

Merged
merged 7 commits into from
Jan 30, 2023
Merged

Conversation

ferferga
Copy link
Member

Doesn't work in development because vuejs/core#7567

  • This PR lays the groundwork and adds some hints to some files, with ideas of how I see those features reimplemented for playback.
  • Only music works at this point, but without AudioContext or any fancyness.

@jellyfin-bot jellyfin-bot added the vue Pull requests that edit or add Vue files label Jan 25, 2023
@ferferga ferferga force-pushed the playback-minor-improvements branch 4 times, most recently from f24a4e5 to 5296316 Compare January 26, 2023 15:54
@jellyfin-bot jellyfin-bot added the merge conflict Something has merge conflicts label Jan 26, 2023
@jellyfin-bot jellyfin-bot removed the merge conflict Something has merge conflicts label Jan 26, 2023
frontend/locales/en-US.json Outdated Show resolved Hide resolved
frontend/src/components/Layout/AudioControls.vue Outdated Show resolved Hide resolved
frontend/src/components/Layout/TimeSlider.vue Outdated Show resolved Hide resolved
* Once the user releases the slider, change the time of the playbackManager with whatever
* input value was provided by the user
*/
function releaseMouse(): void {
Copy link
Member

Choose a reason for hiding this comment

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

What about using a name describing what does the function instead of when it is supposed to be called? Like setNewTime or whatever. Now this isn't important anymore, but previously we had many events, some referring to the same function. That's why I think event functions should be named for what logic they do, not on what event they are called

Copy link
Member Author

Choose a reason for hiding this comment

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

It's indicated in the comments though. Which name do you suggest?

Copy link
Member

@ThibaultNocchi ThibaultNocchi Jan 27, 2023

Choose a reason for hiding this comment

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

I don't know, something more related to what its role is, not its event. So something like setNewTimeFromSlider or whatever. The comment is great, but when seeing the function called in the template, you can't directly know what it does.


const sliderValue = computed({
get() {
return playbackManager.currentVolume;
Copy link
Member

Choose a reason for hiding this comment

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

Why drop the isMuted logic?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see this comment in time slider, not in volume slider. What do you mean?

Copy link
Member

Choose a reason for hiding this comment

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

Before your commit, the slider had this prop: :model-value="playbackManager.isMuted ? 0 : playbackManager.currentVolume". Is it intended you dropped the fact that the slider is (virtually) at 0 when muted?

});

/**
* If the player is a video element and we're
Copy link
Member

Choose a reason for hiding this comment

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

And we're what? :p

Copy link
Member

Choose a reason for hiding this comment

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

/**
 * If the player is a video element and we're
 */
const teleportTarget = computed<'body' | '.video-container'>(() => {
  return mediaElement.value === 'audio' ? 'body' : '.video-container';
});

if that can help you :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@ThibaultNocchi IIRC I wanted to continue with something like this:

If the player is a video element and we're in the PiP player or fullscreen video playback, we need to ensure the DOM elements are mounted before the teleport target is ready

frontend/src/components/Playback/PlayerElement.vue Outdated Show resolved Hide resolved
frontend/src/store/items.ts Outdated Show resolved Hide resolved
frontend/src/store/playbackManager.ts Show resolved Hide resolved
@ThibaultNocchi ThibaultNocchi force-pushed the playback-minor-improvements branch 2 times, most recently from eb9a801 to e0c39d8 Compare January 29, 2023 17:03
frontend/src/components/Playback/PlayerElement.vue Outdated Show resolved Hide resolved
});

/**
* If the player is a video element and we're
Copy link
Member Author

Choose a reason for hiding this comment

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

@ThibaultNocchi IIRC I wanted to continue with something like this:

If the player is a video element and we're in the PiP player or fullscreen video playback, we need to ensure the DOM elements are mounted before the teleport target is ready

ferferga and others added 7 commits January 30, 2023 15:32
* Don't use async storage

* Use arrow functions for TypeScript compatibility with this

* Add store keys as constants

* Fix defaultState being mutated using Object.assign as well, create a clone with lodash's cloneDeep
* This commit lays the groundwork and adds some hints to some files, with ideas of how I see those features reimplemented for playback.
* Only music works at this point, but without AudioContext or any fancyness.
* Change folder layout from Players to Playback
Backdrop was breaking v-app's behaviour. The order of the elements is important for things like v-hover to work properly
@jellyfin-bot jellyfin-bot removed the merge conflict Something has merge conflicts label Jan 30, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 30, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jellyfin-bot
Copy link

Cloudflare Pages deployment

Latest commit 350789f
Status ✅ Deployed!
Preview URL https://544a7d46.jf-vue.pages.dev
Type 🔀 Preview

View build logs
View bot logs

@ferferga ferferga merged commit 097079a into vite Jan 30, 2023
@ferferga ferferga deleted the playback-minor-improvements branch January 30, 2023 18:26
@ferferga ferferga added this to the Vue 3 milestone Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vue Pull requests that edit or add Vue files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants