-
Notifications
You must be signed in to change notification settings - Fork 99
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
controlling youtube videos ( loaded in the fancy iframes ) via youtube API #702
Comments
The id "fancybox-frame1730292793426" is the one that makes enablejsapi=1 useless. If that ID were to be "player", then we would be home controlling YT all day long. Is there a way ( even a hacky way ) to let fancy to always generate id=" Here is more info on this, FYI: The enablejsapi parameter in a YouTube iframe URL enables the JavaScript API for the embedded player. Here's what it does: Enables JavaScript API Control: By adding enablejsapi=1 to the iframe URL, you allow your web page to control the YouTube video player using JavaScript. This includes starting, stopping, pausing, and seeking within the video. Event Handling: It allows you to listen for events from the player, such as when the video is played, paused, or has ended. You can respond to these events in your JavaScript code. Access to Player Methods: With the API enabled, you can call various methods on the player object, such as: playVideo(): Starts playing the video. Example Usage In this example, replacing VIDEO_ID with the actual ID of the YouTube video will create an iframe that enables the JavaScript API for that video. You can then use the YouTube IFrame API to control the video and listen for events as needed. Summary |
Janis, I found this on the source.
If I hack this part and change that ID and Name to simple YT API compatible "player", will there be a side effect as far as the rest of the code? I am fully aware that an update would erase that but I do not have any other option to use YT APIS for the time being. |
Hi, There are plans to completely rewrite the part that creates and controls video embeds, making it much easier to control videos regardless of the source. Currently, there is no such functionality. As alternative, you could use Plyr or any other video player. |
when we play youtube videos,fancy box generates an iframe in the staged area as follows:
<iframe id="fancybox-frame1730290693734" name="fancybox-frame1730290693734" class="fancybox-iframe" allowfullscreen="" allow="autoplay; fullscreen" src="//www.youtube-nocookie.com/embed/oG-RuUA0CJA?autoplay=1&autohide=1&fs=1&rel=0&hd=1&wmode=transparent&enablejsapi=1&html5=1" scrolling="no" title="''I had a dream...'' Convert Muslim Baruska Evs #revertmuslim #shorts"></iframe>But I do need to detect the video on pause, on stopped, on play youtube API events. the "enablejsapi" may make it happen I guess. but i could not see any sample code to make this happen with fancy. can you point me to some demo of someone who showcased it if you know anyone?
The text was updated successfully, but these errors were encountered: