戻る

YouTubeの特定のチャンネルの録画を取得する

chapter46.html

<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript">

$("#index").live('pagecreate',function(){

	var channel = "OTOYAMOVIE";
	
	var con = $.getJSON("http://gdata.youtube.com/feeds/api/users/" + channel + "/uploads?alt=json",
	function(data){
			
		$("[data-role='header'] h1").text(data.feed.title.$t);

		$.each(data.feed.entry, function(i,item){
			
			var video = "<video controls width=\"320\" height=\"240\" poster=\"" + item.media$group.media$thumbnail[0].url + "\">";
			video += "<source src=\"" + item.media$group.media$content[1].url + "\" type=\"video/3gpp; codecs='mp4v.20.8, samr'\">";
			video += "動画を再生するにはvideoタグをサポートしたブラウザが必要です。";
			video += "</video>";
			video += "<a href=\"" + item.media$group.media$content[0].url + "\">" + item.title.$t + "</a>";
			
			$("#video").append(video);
			
			$("#video a").button();
		});
	});
	con = null;
});
</script>
<style>
video{
	display:block;
	margin:0 auto 10px auto;
	padding:0;
	width:320px;
}
</style>
<title></title>
</head>
<body>
<div data-role="page" id="index">
	<div data-role="header">
		<h1></h1>
	</div>
	<div data-role="content">
		<div id="video"></div>
	</div>
	<div data-role="footer">
		<h4>Yohsuke Nakano</h4>
	</div>
</div>
</body>
</html>

inserted by FC2 system