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

[audioplayer] Proposal to add a "when" tag option #30

Open
floriancargoet opened this issue Nov 29, 2022 · 0 comments
Open

[audioplayer] Proposal to add a "when" tag option #30

floriancargoet opened this issue Nov 29, 2022 · 0 comments

Comments

@floriancargoet
Copy link
Contributor

audioplayer tags are processed immediately but the paragraph they are associated with may appear later (because of animations or a #delay).
I believe audio should be triggered only when the paragraph is shown.
Something like this works nicely.

Tags.add("playonce", function(story, property)
{
	property = process(story, property);
	story.queue.onShow(() => {
		audio.play(story, property, property.options, false); 
	});
});

What do you think?

We may go further and anticipate people wanting to trigger it after the animation (onRendered).
I think a nice way of exposing those possibilities would be to add a "when" option.

#playonce: my_sound >> when:shown
#playonce: my_sound >> when:rendered
#playonce: my_sound >> when:now // default

We could do "rendered + 1000ms" by combining it with delay

#playonce: my_sound >> when:rendered, delay:1000

Tell me if you like it and I'll send a PR.

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

No branches or pull requests

1 participant