YouTube extract audio with Web Audio API - javascript

Is there a way to access audio track from YouTube video using Web Audio API?
Is there a way to load parts or whole YouTube video using <audio> or <video> tags?

i dont think so - you are able to embed videos via <iframe>, but there is no option to extract and embed music out of youtube videos.

Related

Cant play videos faster than 2x with youtube iframe api

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.

separating audio layer and video from YouTube

Can I separate audio layer and video from YouTube and add only audio to my website? I want to create app like spotify but I want to play music for example from YouTube
Use YouTube-dl to download the audio streams. You could probably stream them too in real time if you were fancy.

mediasource local video segment by js

I want to play local video by web browser with js. Normally, it would be solved with html5 video tag. but the video was too big, ram couldn't contain it. So I decided to streaming local video file on browser not through server. I search it and I found that mediasource API able to do that, but I failed play my video. I search again more then I found video segments(initialization segments and media segments) form needed. but I couldn't find the way how to make it.
how can make video segments by js?
Is there any kind of api support to make it?
please not just about mp4box. mp4box is just for mp4 type. I want play every type of video that supported in video tag.

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.

Categories