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

Multiple streams playing after d'n'd audio widget with autoplay set to true. #11

Open
f1ames opened this issue Jul 22, 2016 · 3 comments
Assignees

Comments

@f1ames
Copy link

f1ames commented Jul 22, 2016

Hi again,
after adding an audio with autoplay option set to true and then dragging it somewhere else, the multiple audio streams starts to play (despite the audio tag is in a paused stated). I attached the screenshot showing multiple audio streams being fetched by the browser at the same time:
screen shot 2016-07-22 at 11 04 39

@aldatsa aldatsa self-assigned this Jul 26, 2016
@aldatsa
Copy link
Member

aldatsa commented Jul 28, 2016

I tried pausing the audio, setting the src attribute to an empty string, and even removing the audio element itself on the dragstart event but it doesn't work, 1 second or so after starting to drag the widget the second stream of audio starts playing.

init: function() {
    ...
    var that = this;
    ...
    editor.on( 'dragstart', function( evt ) {
        that.element.getChild( 0 ).$.pause();
        that.element.getChild( 0 ).setAttribute( 'src', '' );
        that.element.getChild( 0 ).remove();
    } );

@aldatsa
Copy link
Member

aldatsa commented Jul 28, 2016

I tried removing the autoplay attribute as well:

that.element.getChild( 0 ).removeAttribute( 'autoplay' );

and using a more specific way to select the audio element:

that.element.getElementsByTag( 'audio' ).getItem( 0 )

instead of getting the first child:

that.element.getChild( 0 )

But no luck so far. It looks like a "shadow" audio element is created when I start to drag the widget. Is it possible?

@f1ames
Copy link
Author

f1ames commented Jul 29, 2016

Thanks for your efforts @aldatsa.
When it comes to widget system, there is some logic happening behind the scenes which indeed may be the cause of this issue (not sure if it is "shadow" audio element though) and so applying the fix from the plugin code may be quite difficult (if possible). I may get back to you in some time if I get some understanding what is exactly happening in this case.

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

2 participants