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

fix: volume keep resetting after stopping playback #1971

Closed
wants to merge 3 commits into from

Conversation

noaione
Copy link
Contributor

@noaione noaione commented Apr 17, 2023

Since the media element itself got removed after stopping, we basically need to reapply the current volume.
The solution is to just check if the mediaElementRef got set to null or HTMLMediaElement and then manually apply the current volume to the element directly.

Fix #1956

Since the media element itself got removed after stopping, we basically need to reapply the current volume.
The solution is to just check if the `mediaElementRef` got set to `null` or `HTMLMediaElement` and then manually apply the current volume to the element directly.

fix jellyfin#1956
@jellyfin-bot jellyfin-bot added this to In progress in Ongoing development Apr 17, 2023
Copy link
Member

@ferferga ferferga left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution and sorry for the delay!

We renamed the currentVolume property from the reactive state to remoteCurrentVolume because we didn't think about this possible edge case. Rename it back, modify the getters/setters and just use VueUse's syncRef (you might need to use toRef too from them, as state's currentVolume is just a reactive property, but not a ref.

As stated in the comment, playbackManager never refers to the player element specifically, so your approach is completely undesired here.

@jellyfin-bot jellyfin-bot added the vue Pull requests that edit or add Vue files label Apr 19, 2023
@noaione
Copy link
Contributor Author

noaione commented Apr 19, 2023

Applied your suggestion, although I don't know if it's what you wanted

@noaione
Copy link
Contributor Author

noaione commented Apr 19, 2023

Looks like I did something wrong since the volume is resetting again

@sonarcloud
Copy link

sonarcloud bot commented Apr 19, 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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jellyfin-bot
Copy link

Cloudflare Pages deployment

Latest commit 37392fa
Status ✅ Deployed!
Preview URL https://0448f7a3.jf-vue.pages.dev
Type 🔀 Preview

View build logs
View bot logs

@ferferga
Copy link
Member

@noaione I found out that this is a VueUse's bug. Opened PR there vueuse/vueuse#2999, as the bug is an inconsistency between the DOM element's and composable's state.

Will keep this PR open until the fix is merged upstream and VueUse is updated by Renovate PRs to track this issue (and in the strange case we need to perform additional changes)

You can test my VueUse's changes by adding locally a copy of the composable and importing it instead from VueUse. The behaviour should match 1:1 your branch here. If not, please let me know so we can review it

@ferferga
Copy link
Member

Checked and fixed for me in #1970

Please let me know if there's an edge case not working as expected

@ferferga ferferga closed this Apr 22, 2023
Ongoing development automation moved this from In progress to Done Apr 22, 2023
@noaione noaione deleted the fix-volume-reset branch April 23, 2023 01:00
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
Development

Successfully merging this pull request may close these issues.

Media volume resetting when stopping/playing back
3 participants