Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Justin Houghton4,560 Points
I am trying to add a full screen event listener to an youtube iframe video.
My goal is:
- An embedded Youtube video is muted on auto play
- When full screen mode is active, video is un-muted
Knowing how amazing the treehouse community is, and how it's helped me so much in my journey to understand programming, I thought I would ask here!
Steven Parker225,652 Points
I can't speak from experience, but I think you have the right idea. Create a listener for the "fullscreenchange" event and then inside it check document.fullscreenElement to see if you you just switched into the full screen mode, and then call player.unMute() on the YouTube API.
I'm sure the YouTube developer resources will come in handy for testing.