Real Software Forums
http://forums.realsoftware.com/

how do you use youtube player API
http://forums.realsoftware.com/viewtopic.php?f=23&t=38054
Page 1 of 1

Author:  shingo nio [ Thu Mar 10, 2011 9:29 pm ]
Post subject:  how do you use youtube player API

I know youtube movie control by YouTube JavaScript Player API.
I know realbasic web edition support youtube Controller and with ExecuteJavaScript.
I want know how do I use YouTube JavaScript Player API in real basic.

example html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<title>YouTube movie sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--▼A Use the Google AJAX Libraries API: http://code.google.com/apis/ajaxlibs/
SWFObject:http://code.google.com/intl/ja/apis/ajaxlibs/documentation/index.html#swfobject -->
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("swfobject", "2.1");
</script>


<script type="text/javascript">

function onYouTubePlayerReady(playerId) {
//alert(playerId);
if(playerId == "ytplayer1"){
ytplayer1 = document.getElementById("myytplayer1");
}
if(playerId == "ytplayer2"){
ytplayer2 = document.getElementById("myytplayer2");
}
}

//動画コントロール▼B-2
function play1() {
if (ytplayer1) {
ytplayer1.playVideo();
ytplayer1.setVolume(20);
}
}
</script>

</head>
<body onload="setTimeout('play1()',3000)"><!---->
<!--->
<div id="ytapiplayer1">
You need Flash player 8+ and JavaScript enabled to view this video.
</div>
<!--▼D SWFObject-->
<script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: "myytplayer1" };
swfobject.embedSWF("http://www.youtube.com/v/zQ8nsE2XC7k&enablejsapi=1&playerapiid=ytplayer1&rel=0
&color2=0xcd311b",
"ytapiplayer1", "480", "295", "8", null, null, params, atts);
</script>

</body>
</html>

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/