开发者

Classic ASP and Youtube Player

开发者 https://www.devze.com 2023-02-14 19:29 出处:网络
Im looking for help as to what I need to do to be able to display the Youtube player. The following code is fine if its a web page e.g. www.youtube.com but when I change the url to the Youtube playe

Im looking for help as to what I need to do to be able to display the Youtube player.

The following code is fine if its a web page e.g. www.youtube.com but when I change the url to the Youtube player it displays the characters CWS and some other weird characters.开发者_Go百科

I've tried various Contenttype but had no joy.

Any suggestions appreciated, sorry its classic ASP but I rarely dip my toes into this side of things and its all I know and alas that is very little.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%  
response.ContentType="video/mpeg"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<%      
url = "http://www.youtube.com/v/u1zgFlCw8Aw?version=3" 
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 

xmlhttp.open "GET", url, false 
xmlhttp.send "" 
Response.write xmlhttp.responseText 
Set xmlhttp = nothing
%>

</body>
</html>


Your ContentType shouldn't be anything but text/html (ie: don't change it).

You don't need to open fetch anything from Youtube. Just use add their embed code to your page as-is and it should work:

<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/u1zgFlCw8Aw" frameborder="0" allowfullscreen></iframe>
0

精彩评论

暂无评论...
验证码 换一张
取 消