oskarrough/ember-youtube

Add support for changing isMuted and isPlaying.

PlasmaPower opened this issue · 2 comments

Currently, changing isMuted and isPlaying have no effect. This means there is no good way to mute or pause the player.

Edit: For future visitors, it would appear I am supposed to use delegate-as to do this.

I'm working on making a PR to fix this now.

Thank you, as of 0.5.1 it now works properly. Check the demo http://ember-youtube.surge.sh and readme for examples.

What you need to do is target the emberYoutube component. To do that, first expose it:

{{ember-youtube ytid=youTubeId delegate=controller delegate-as="emberYoutube"}}

then call the appropriate methods:

<button {{action "togglePlay" target=emberYoutube}}>
    {{#if emberYoutube.isPlaying}}Pause{{else}}Play{{/if}}
</button>
<button {{action "toggleVolume" target="emberYoutube"}}>
    {{#if emberYoutube.isMuted}}Unmute{{else}}Mute{{/if}}
</button>

<button {{action "play" target="emberYoutube"}}>Play</button>
<button {{action "pause" target="emberYoutube"}}>Pause</button>
<button {{action "mute" target="emberYoutube"}}>Mute</button>
<button {{action "unMute" target="emberYoutube"}}>Unmute</button>

and call send, pause to control playback.