does anyone know how and what javascript to use to change the playlist of a iframe youtube player?
I have searched the net but can't seem to find a simple piece of code for it.
I believe you're looking for the loadPlaylist() function of the YouTube Player API.
Related
So I have a website like YouTube and I want to monetize it. It uses simple HTML5 video player to display dynamic videos. I don't want to integrate any other player because my site is designed for HTML5 players. I have watched couple of videos about this, and neither of the source codes worked (It didn't display the ad itself). I use Adsterra VAST tag, so I don't know if it's their problem or not. I would be very happy if someone can help me with documentations or sample codes. Thank you!
So you would need to use IMA SDK for html5 player:
https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side
In there you can find the necessary code to do it, sorry for the late reply i just found this ticket.
I'm trying to embed both Youtube & Vimeo videos in the same player,
I found this https://github.com/jakiestfu/Youtube-TV and it looks exactly how I want it, except its purely youtube videos.
I want to be able to provide youtube & vimeo links that will be embedded like the Youtube-TV plugin.
I googled and searched stackoverflow but no use.
Any tips where to start?
I'm making a web app and a bookmarklets for my website so that user can directly bookmark any video in their browser through any youtube video posted on my website.
hi anyone can help me to solve this for youtube video bookmarklets
I want to keep only youtube video ID in following code
javascript:(function(){window.open('http://example.com/bookmarklets/bookmark?id='+encodeURIComponent(location.href)+'')})();
Result should be : http://example.com/bookmarklets/bookmark?id=LIQZ6CjpHUA
but when i test above code i found that it takes whole youtube URL instead of youtube video ID
Instead of above result i got this : **http://example.com/bookmarklets/bookmark?id=https://www.youtube.com/watch?v=IUeqywml0SU
but i want only this result : http://example.com/bookmarklets/bookmark?IUeqywml0SU
I found the answers by myself...
here are the code
When we'll use this bookmarklet
javascript:(function(){window.open('http://example.com/download/'+encodeURIComponent(document.title)+'?id='+encodeURIComponent(location.href.replace('https://www.youtube.com/watch?v=', ''))+'')})();
For this youtube video
https://www.youtube.com/watch?v=GhQGm9d4e8c
We'll get this final output from URL:
GhQGm9d4e8c
Thanks
Question:
How can I control the sound output of this embedded video without overly complicating things?
Possible Solution (Complex)
I've looked into the youtube javascript control API, and, correct me if I'm wrong, but that will force me to incorporate a lot of complication into the setup to accomplish what appears to be a very simple task.
Note:
This is all only tested for webkit at this stage
Setup:
I've created an element that simulates an iphone controlling the channel of a tv by swapping youtube videos like so:
var channel1 = "http://www.youtube.com/embed/dFU6Cy4Hd5A?autoplay=1&rel=0&controls=0&showinfo=0&disablekb=1&iv_load_policy=3&modestbranding=1";
$("#channel-1").click(function(){
$("#tv").attr("src", channel1);
});
where the #channel-1 id is connected to a specific button on the remote, and the tv id is connected to the video player.
It looks like this:
Edit:
If the API is the only to accomplish this, please include a link to a comprehensive tutorial teaching the youtube web API, because I've looked, and found nothing. The only thing I've found so far is the official API page, and that's like trying to learn PHP from the manual.
For loading videos you would use loadVideoById rather than the rather odd snippet you have in your question and to play without audio you simply mute the player using player.mute() (where player is a reference retrieved from the youtube player element itself like described here). And one last thing, don't forget to add enablejsapi=1 to the url of the player as described here.
I would use
event.target.mute();
I am using this javascript code to get a downloadable video URL from the mobile youtube website.
[webView stringByEvaluatingJavaScriptFromString:#"function getURL() {var player = document.getElementById('player'); var video = player.getElementsByTagName('video')[0]; return video.getAttribute('src');} getURL();"];
Output URL: http://o-o.preferred.seabone-mil1.v22.nonxt2.c.youtube.com/videoplayback?el=results&begin=0&yms=5682703339584930992&itag=18&ip=87.0.0.0&app=youtube_mobile&signature=B8CD6B60D2609F5F137B885806F8FAECAA88492F.333D3F19876A77CECB264059A3852BD021401296&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Csource%2Cratebypass%2Ccp&len=254000&ratebypass=yes&source=youtube&expire=1323579819&sver=3&key=yt1&ipbits=8&cp=U0hRSFVSV19GU0NOMV9NTEFJOmV5Qk5wc3hWaUxG&id=b8e73777013e0b7e&ps=blazer
I would like to do the same with just the audio of the video. But i haven't succeeded yet. Can anyone help me?
I solved it! I use the youtube-mp3.org api which works really good. there are some questions about it on SO with good answers!
It's going to be difficult to extract the audio only portions from an existing video from within iOS. I'm sure there are libs out there that can help, but I think it's going to be an involved topic.
Perhaps you can take a look at Display YouTube Videos Without Exiting Your Application. It describes ways to play youtube videos from within your iOS application. Now if you do something similar but set the view to be hidden, you would be able to "listen" to the youtube videos's audio without showing the video itself on the screen.
I don't know what the end-goal is for you're application, but perhaps my suggestion will be food-for-thought.