Check if YouTube streaming video is live or not - javascript

I am trying to check if a (public) YouTube streaming video is live or not.
I tried to use YouTube Player JavaScript API, but I can't find anything that may help me to find out if the streaming is already started or not.
I saw the YouTube Live Streaming API, but I can't find JavaScript examples of using it.
Thanks.

You just need to do videos.list request and from response look at actualStartTime
You can use this line for example, just modify it to videos.list

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.

Embedding Youtube Videos Using Youtube API (Code not working)

Working with API's tend to be quite confusing for me. That being said I found a bit of code at
HTML Auto Embedding Recent Uploaded videos from a youtube channel
I am unable to get it to work for myself, What should I be doing to make this work successfully? I currently have code in HTML file # https://foxumtv.com/videotest.html and as you can see it simply displays white page.
Thanks for any help I do apologize I am bit of newbie when it comes to webpage scripting.
You can check in the YouTube IFrame Player API on how to Embed a YouTube player. Here, you need to use the <iframe> tag to your application in which the src URL specifies the content that the player will load as well as any other player parameters you want to set. To specify the dimension of the player, you can use the height and width parameter here.
Here is the example for that.
For more information, just check the documentation link above.
NOTE: YouTube embeds were deprecated on January 27, 2015.
Please migrate your applications to use embeds, which can
intelligently use whichever embedded player – HTML () or Flash
() – the client supports.

Is there anything like youtube-dl, but in pure jquery or js?

Is there anything like http://rg3.github.io/youtube-dl/
which will allow to get json of youtube movie,
get direct links to various format of videos,
even with username and password, to private yt movies?
I know this is an old question but if you're still interested check out the project called node-youtube-dl. It allows you to download videos directly from YouTube and many other video providers.
If you're more interested only in the YouTube platform, I suggest you checking out node-ytdl. It is a youtube downloader written in Javascript. To be used with the command line. If you're looking to use it in your node program, check out, node-ytdl-core.
Links:
https://github.com/fent/node-youtube-dl
https://github.com/fent/node-ytdl
https://github.com/fent/node-ytdl-core

Embed youtube comments with a live streaming video

Using some of the code I got here I was able to pull in comments on a regularly uploaded youtube video using JS and the Youtube API including title, author views and comments using the code found here:
Stackoverflow answer used
And my working example of a normally uploaded video:
Working Static Video
I have been trying to pull in a stream instead of a regularly uploaded video and the video itself is being pulled in great, but the rest of the info like the title and comments, which are the most important thing no longer show.
Example Using a Youtube Stream
I thought maybe it was because the stream was not live, but that doesn't seem to be the case since I can view the comments on a static page like any normal video its just positioned differently and I cant seem to find any info on the info having to be pulled in differently on a stream in the API.
Any help would be greatly appreciated.

RTSP stream for QuickTime player does not show movie

Did anybody faced to problem when QuickTime cannot play streaming video and shows blue question mark instead or errors - 400 (Bad Request) and 10060 (Disconnected)? I have already tried to switch getting stream from UFP to HTTP protocol with custom port in QuickTime settings but this did not help.
And does anybody know where can i find streaming video using RTSP protocol just for testing, links to online streams (not downloaded trailers) are appreciating.
These links do not work for me due to issue mentioned above:
http://mac.sillydog.org/qt/mov/embed_stream.php
And here only last one works (among other streaming types) :
http://quicktime.tc.columbia.edu/users/iml/movies/mtest.html
Thanks, for any links and advices.
The best way I've found to get rtsp streams to play in a browser window is using Apple's own javascript. I've tried hard coding tags with exactly the same parameters, and the embed tags won't work, but the js will. The js file itself is called AC_Quicktime.js. Just google it and you should be able to find a link to it easily enough. Use the one from Apple's site to make sure that you're getting unmodified code. Load that in your HTML page, and in your body, insert this:
<script>
QT_WriteOBJECT(*url*,*width*,*height*,*ActiveX Version*,*parameter1*,*value1*,*parameter2*,*value2*,*parameter3*,*value3*);
</script>
This will draw the appropriate code in whatever container you place the script. ActiveX Version can be an empty string (''), and as many parameters as you like can be entered one after the other. Apple has fairly exhaustive documentation on their website for all their stuff.Apple Developer Connection.
Hope that was marginally helpful.
it appears that this was just a security issue and stream was stopped by private policy of Quick Time so to turn on the ability to play RTSP stream in Safari i needed to check some option in browser settings ...
http://www.niehs.nih.gov/news/video/help/

Categories