Load only audio from youtube in as3 - actionscript-3

Is it possible to load only the audio from YouTube into my AS3 flash custom player through youtube AS3 api?
I want to load it into a sound object and then assign it to a sound channel.
I would like to know if there is an "official" way to do this, I'd like to avoid improvising (like loading the whole stream and then use only the audio).
Thank you.

I suggest you read the YouTube terms of service carefully:
https://developers.google.com/youtube/terms
In particular, you may not "promote separately the audio or video components of any YouTube audiovisual content made available through the YouTube API".
Doing so in any way (such as moving the video off stage) is likely to have your site blocked for playbacks by YouTube for breach of terms of service.
NB: YouTube manages to provide the service it does through advertising on top of video content. Separating the content like this prevents YouTube from making any money from the service it is providing.

If you use it for private usage, its okay I guess.
After some research work with different APIs and libraries and researching source code, I just tried it by myself and wolla.
Just saying, audio only links are in the page source of each video.
You just have to know what you are looking for ;)
Open a youtube video, view page source and search for "mime%3Daudio". There should be 5 matches, full url for example:
"https%3A%2F%2Fr2---sn-35cxanpbo5a-8pxl.googlevideo.com%2Fvideoplayback%3Fsource%3Dyoutube%26signature%3D30EC556F55533FBFD9003767730D10556681F33A.B12E021CA54CCB9E225F58A4430E9BB528081FB5%26requiressl%3Dyes%26expire%3D1527306011%26clen%3D3064602%26initcwndbps%3D1152500%26ipbits%3D0%26mime%3Daudio%252Fmp4%26dur%3D192.911%26fvip%3D5%26lmt%3D1524946334873350%26key%3Dyt6%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Ckeepalive%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26itag%3D140%26gir%3Dyes%26ip%3D81.217.53.239%26id%3Do-ALNxMeQYw4LLc1FAjxt4h795wKTdqJnzc_SBgzEJVBxR%26c%3DWEB%26keepalive%3Dyes%26mm%3D31%252C29%26mn%3Dsn-35cxanpbo5a-8pxl%252Csn-2gb7sn7r%26ei%3Du4IIW7DfC46rgAfrrpnICw%26ms%3Dau%252Crdu%26mt%3D1527284230%26pl%3D16%26mv%3Dm"
Just decode URL and you got what you want.

Related

Can I request YouTube to let my site play restricted embedded video?

I am working on a site that will allow users to upload their videos on my site, for example a dance performance. I am using <iframe></iframe> to embed video. Everything was going fine, but suddenly I noticed YouTube is restricting some videos to play on my site.
In my case the error was:
I know some users have asked similar questions like 'why it is happening' etc. I know it has to do with some copyright issues, for example a dance performance may have a background music playing which happens to be someone others property. The thing is, I am not 'claiming' copyrights and even, not me but my users will upload their videos from their YouTube accounts(using URL).
So Is there anyway to play all those videos like if I can request YouTube to let my site play those videos with a disclaimer explaining that my site doesn't have copyrights of these videos?
Does using iframe to point at the non-embedded youtube widget work? If so you could use javascript to extract the player from the regular youtube.
Not sure about the legality of that.
What are you trying to do? Potentially you could use the youtube api and make a mobile app that is not embedding videos.

Insert html video player in As2 page

I have a online courses with a lot of videos. These videos are in Vimeo for the app of this courses but I use flv loaded to the server in my flash version and the administrator wants to get off these flv.
Cause I don't know a bit of AS3, i can't use the vimeo api. So:
How can I display a webpage (where an html player will be running the video) in my swf? Like some kind of web object. The result, must be the video page inserted in the swf area
Please, be specific in your answer, my knowledge of coding is poor.
Thanks a lot! :)
The best way to approach this would be to setup an ExternalInterface in the Flash course that will communicate with the page. From there, Flash can call a method that is responsible for rendering an iframe embed of the Vimeo player. You'll probably have to pass both the video_id and the location where the video should be displayed (x/y in the event that it changes).
Once you have the javascript setup to render the iframe embed where you need it, you can interact with the player via the Javascript API (https://developer.vimeo.com/player/js-api). The player would essentially be rendered above the Flash (kind of like a lightbox), but will allow the control that you need.
You can also setup whatever playback controls that you need to pass from Flash to Javascript, and eventually to the iframe via the API.
Please let me know if you need any more clarification on how this can be setup.

Embedding html5 video with opengraph on facebook

I have built a web site for our student tv station and the concept is pretty similar to youtube. We would like for our videos to be playable directly in facebook when shared, with the videos themselves still hosted on our server and our stats being updated.
The player on the site uses videojs and is all working with the html5 video tag. There is also an embeddable version of the player that can run in an iframe. Ideally I'd like this to be used on facebook but don't think it's possible. This is what I've attempted at the moment with the og:video:type value set to text/html and og:video set to the embeddable player url and it doesn't appear to work. Here is an example page, and here is the embeddable player for it.
The only other ways I've seen is to specify a url to the video file, or a url to a flash player.
All of our videos are rendered at different qualities/resolutions and on our site and embeddable player there is a quality selection bar that changes the video url in the player. However it looks like with opengraph and facebook there is no way of giving it the urls to the different qualities or having the user pick the one they want on facebook, meaning we're stuck with forcing everyone to watch at one of the qualities. Is this right?
So then the only other option that appears to be available is building a custom flash player which has quality selection built into it. From what I can tell this is what youtube is doing. Is this the only option though because I don't want to build a custom flash player for Facebook to then decide in a few months that they're not supporting flash anymore?
I realise similar questions have been asked already but I couldn't find a definite answer and some of them were over a year old.
Thanks.
Facebook is currently trialing iframes with YouTube. Hopefully the support will be rolled out to everyone soon.
More info at this question: Embedding video player html5 iframe in facebook share like YouTube

Youtube Video In HTML5 <video>

I have made a windows store app using the Youtube Iframe API. I can handle events and play video fine but there is a major problem as it doesnt support full screen mode (amongst some other minor niggles).
I have been looking in the app store and I see that the majority of youtube player apps do not use the iframe API, they grab the video direct and put it into the standard HTML5 video player.
I have done a lot of searching and the only way I can see people are doing this is by parsing the youtube page to find the video file the Youtube player is going to play and loading this directly into the media player.
I have a few problems with this method.
I am not sure if this is legal as it may break youtubes terms and conditions
If page at youtube changes it can break app.
Neither of these situations are acceptable.
Is there any way to get full screen to work inside app or get a direct video stream legitimately?
Not sure about the copyright and youtube terms stuff but here is how you do it apparently:
Show Youtube video source into HTML5 video tag?
Looks like it's browser specific and youtube generates different html for different browsers.
I would make an ajax request to the youtube url appending html5-true then use jQuery to scrape the source for the video tag, add your attributes and then append to your page.
Now you have the tag that youtube uses so I'm assuming what works on their webpage will work o yours.
Probably violates all terms and conditions...

Video in Browser: Embed YouTube and others

I want to embed videos from different video sites like YouTube, Vimeo and so on...
But I have a problem:
The Skins of the players are all different
and I want a consistent video skin.
Is there any possiblity to get this work?
I can't host the videos on my server because I have to pay for the traffic
and that would make me poor =(
I know that Youtube at least has a chromeless player, you can check out the API here: http://code.google.com/apis/youtube/js_api_reference.html#GettingStarted
I don't know about any of the other sites, though. I'd try Googling the name of the site and "chromeless" or "api" to see what comes up.
Simply put, no. The video site content has to include the skin for each site, unless you rip the video out and self-host it.
There's a reason for this, and I doubt you'd want to see the sites all fold/go paid because of people hijacking content without attribution.
Try Media Element JS
It wraps your youtube and vimeo video to a HTML5 video, no need to host the video on your website. The script from the website can take youtube and vimeo videos and make convert them into HTML5 video.
One side effect of this script is that since it can convert both Youtube and vimeo videos to HTML5 then the players will be the exact same for both of them.
Hope that helps,
regards