How to make a YouTube chromeless player?

我的未来我决定 提交于 2020-01-30 05:43:53

问题


This may sound stupid but I looked online for some time and I could not find how to make a YouTube player chromeless. I am making a web app and I am using the YouTube JavaScript API. Wherever I look online for some information on how to actually make the player chromeless, it just gives me information on how to operate with a chromeless player. Nobody addresses this question (it seems to be obvious), but I just can't figure out how to do it. Could someone please explain to me how to do it (do I need to pass a certain parameter somewhere?) Thanks.


回答1:


Alright, so I figured it out. So, if you are using JavaScript as I did (I believe it also works for AS3), simply, instead of writig the video ID in the URL (the one that you give to the embedswf() function), write "apiplayer". Then, after the video player has loaded, simply call the function cueVideo() on it (passing it the video ID of the video you want to show). This will make the video player chromeless.




回答2:


Well first you would the HTML Code

<embed src=""/>

Now this takes the url: http://www.youtube.com/apiplayer?enablejsapi=1&version=3

This one doesn't take a ID due to the fact you give it one in JS on the function

onYouTubePlayerReady() 

Here is a little example

<script>
onYouTubePlayerReady = initializePlayer;
function initializePlayer(){
var video = document.getElementById('video');
video.loadVideoById(String id , int starttime , string quality);
var playbutton = document.getElementById('playbtn');
playbutton.addEventListener('click' , playVideo());
var pausebutton = document.getElementById('psbtn');
pausebutton.addEventListener('click' , pauseVideo());
}
</script>

That is the basic script, hope this works!



来源:https://stackoverflow.com/questions/13546027/how-to-make-a-youtube-chromeless-player

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!