1. Update Website CKA to HTML5
2. TV show comment in VIDEO on Youtube
กำลังทดลองใช้เว็บ Youtube ลองสร้าง Comment ในวีดีโอ
แต่ก็ไม่ได้ผลเพราะยังไม่มีใครพัฒนา Future ไปถึงที่เรียก Comment ขึ้นแสดงบน วีดีโอเลย
ฉะนั้นก็ลองมาพัฒนาต่อบน Server ของเราเอง โดยมีขั้นตอนดังต่อไปนี้
1. นำวีดีโอเข้ายังเว็บ HTML5 + Theme js/jquery-1.7.1.min.js
2. แสดงตัวหนังสือจากเว็บ YouTube เรียกเข้ามาใช้บนเว็บโดยใช้คำสั่งดังต่อไปนี้
กำลังทดลองใช้เว็บ Youtube ลองสร้าง Comment ในวีดีโอ
แต่ก็ไม่ได้ผลเพราะยังไม่มีใครพัฒนา Future ไปถึงที่เรียก Comment ขึ้นแสดงบน วีดีโอเลย
ฉะนั้นก็ลองมาพัฒนาต่อบน Server ของเราเอง โดยมีขั้นตอนดังต่อไปนี้
1. นำวีดีโอเข้ายังเว็บ HTML5 + Theme js/jquery-1.7.1.min.js
2. แสดงตัวหนังสือจากเว็บ YouTube เรียกเข้ามาใช้บนเว็บโดยใช้คำสั่งดังต่อไปนี้
//ใช้ตรงBody </div><div id="comments"></div>
<script type="text/javascript" src="js/js.js"></script>
<script type= "text/javascript">
$.ajax({
url: "http://gdata.youtube.com/feeds/api/videos/KrmEyPkgDf8/comments?v=2&alt=json&max-results=50",
//gets the max first 50 results. To get the 'next' 50, use &start-index=50
dataType: "jsonp",
success: function(data){
$.each(data.feed.entry, function(key, val) {
comment = $("<div class='comment'></div>");
author = $("<a target='_blank' class='youtube_user'></a>");
author.attr("href", "http://youtube.com/user/" + val.author[0].name.$t);
author.html(val.author[0].name.$t);
content = $("<div style='font-size: 14px;' class='content'></div>");
content.html(val.content.$t);
comment.append(author).append(content);
$('#comments').append(comment);
});
}
});
</script>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น