Cant play videos faster than 2x with youtube iframe api - javascript

Youtube iframe API doesn't allow player.setPlaybackRate() to be set higher than 2 is there any other way to speed it up more than 2x?

Yes, you can try this script https://greasyfork.org/it/scripts/421610-youtube-speed-up/code
It overwrites _yt_player.xx.yy.zz.kk.getAvailablePlaybackRates() to return an array [0.25 ... 4].

The supported playback speeds are listed by player.getAvailablePlaybackRates() on the Youtube iframe API.
Youtube itself defines what playback speeds it supports. You'll want to implement your own video player (i.e. download the video from YouTube server-side and serve it to your client via a different video player) if you want to change this further.

Related

I want to a create an audio visualizer for youtube videos, but cross-origin requests won't allow access to embedded iframe

My objective is to create an audio visualizer that responds to the playback of a Youtube video. Unfortunately, YouTube uses an iframe, which seems to mean that accessing the media stream is impossible due to cross-origin requests (at least, I haven't been able to get it to work).
Is there a front-end solution? Is there any way to hook into the browser audio, or accomplish this in some other way without accessing the iframe's inner DOM elements?
What about using a library to download the video/audio and store it in local browser cache? Is it possible to sync with the embedded playback by getting a timestamp from Youtube's api and read a local copy for the audio processing? I've been trying all day to select the video element and create an audio context, but I don't know if there are any options to explore.
There is a similar question about 7 years ago: Is there anyway to visualize youtube audio from an iframe using the web audio api?
But the only solution required using something called "youtube-audio-stream" which is some kind of local app to stream youtube audio. At least, I haven't been able to get it to work with codepen, jsfiddle or codesandbox. I'd like it to be used alongside or transparently with the embedded youtube player and I'm not exactly sure if that is the direction I should be looking.
Maybe start with here:
Detect if audio is playing in browser Javascript
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
I am not sure if that would be the solution to your requirement, but worth a try.

HTML5 browser player on youtube video

I would love to know if anyone got some experience on Youtube API's?
Cause i've been wondering if it's possible to embed an youtube video with HTML5 parameters, changing the player to the Browser default player!
Thanks for the support!
While this is technically possible (see for example the YouTube downloader browser plugins that generate a proper link/URL for you), it most probably violates the YouTube API Terms of Service:
II. Prohibitions
Your API Client will not, and You will not encourage or create functionality for Your users or other third parties to:
...
access any portion of any YouTube audiovisual content by any means other than use of a YouTube player or other video player expressly authorized by YouTube;
https://developers.google.com/youtube/terms

generating audio waveform from youtube video

does anyone know if is it possible to render an audio waveform from a video playing in a youtube player using Javascript?
Thank you!
On the client side, it's not possible to isolate the audio from the video data.
You would need to get the raw audio data to be able to then process it with the WebAudio API (e.g. display it).
There are some server-side solutions (extracting audio from video, sending it back etc.), but that's not legal, as it's written in the TOS of youtube:
(https://developers.google.com/youtube/terms?hl=fr)
You are not allowed to:
separate, isolate, or modify the audio or video components of any YouTube >audiovisual content made available through the YouTube API;
promote separately the audio or video components of any YouTube audiovisual >content made available through the YouTube API;
See this questions for more details:
Is there a Youtube API that gives only audio?

Can I get access to a youtube player's playback state without embedding the video?

Using youtube's api, is it possible to detect whether there is an existing youtube video on any page and if so, have access to the playback state of the video?
I looked through youtube's API documentation however it seems I can only have access to the video if I embed it myself. But this needs to work on any youtube page I visit.

Get Flash movie elapsed details from Javascript

Is it possible to determine how much of a Flash video has elapsed from Javascript code? This would be for videos that I have not created and have no control over, e.g. from Youtube, Vimeo, etc.
I don't need to control the video in any way, just need to see how far it has played and, if possible, total running time.
It is possible. But it will be dependent in part on which player you are using. If you are using an embeddable video player, instead of a custom player, the player will need to have a javascript method available to give this information.
In the case of YouTube, an API exists:
http://code.google.com/apis/youtube/js_api_reference.html
But if you build your own player, that loads in another player, for example the chromeless YouTube player for Actionscript 3 - you can monitor the playback with the part of teh application you build, and make it avaiable via the ExternalInterface in actionscript.
The Actionscript ExternalInterface class is the preferred way to handle communication between flash objects and javascript.
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

Categories