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

wait for user interaction before creating audio context #194

Closed
wants to merge 2 commits into from
Closed

wait for user interaction before creating audio context #194

wants to merge 2 commits into from

Conversation

cacko
Copy link
Contributor

@cacko cacko commented Jan 12, 2022

need to wait for user interaction before the audiocontext is created

if that is already made somewhere feel free to get rid of the PR, it just did not work for me at all, now it works, still trying to figure out the transcoding though.
#105

@cacko cacko changed the title formatted all wait for user interaction before creating audio context Jan 13, 2022
} else return undefined;
};
var loadTrack = function (params, autoplay) {
if (typeof window.audioUnlocked == "undefined") {
Copy link
Owner

Choose a reason for hiding this comment

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

Hi!
Thanks for this PR!
Does this mean that the track is not loaded if the user has not made any interaction yet?
What happens if a user (re)connects to LMS? Currently the last played track is loaded, but the track is not automatically played

(about the reformatting I planned to switch to clang-format)

Copy link
Contributor Author

@cacko cacko Jan 14, 2022

Choose a reason for hiding this comment

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

well you can't autoplay stuff, the problem was generally

 	var _audioCtx = new (window.AudioContext || window.webkitAudioContext)();

you will have to interact with the window before creating the context, that a rule in webkit based browsers, FF generally is a bit different having its own autoplay permission.

https://developer.chrome.com/blog/autoplay/#web-audio

about taht resume thing, I do remember from experience, safari browser as usual do their own thing and just tend to lock the whole audio/video.

I know the fix is not great, I just wanted to make as less changes as possible, about the formatting..sorry about that I just have a habbit to click reformat button all the time.

bottom line is never do autoplay of anything nowadays in browser, it is just a recipe for problems

@epoupon epoupon modified the milestone: v3.31.0 Jul 13, 2022
@epoupon
Copy link
Owner

epoupon commented Aug 31, 2022

I recently noticed that sometimes the media session is not working as intended (browsers do not display correctly the controls and the artworks). May be related to this?

@epoupon
Copy link
Owner

epoupon commented Sep 3, 2022

Thanks for your work, it seems to work fine (I just changed a few things)
Will have to seriously investigate the media session problem now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants