1 <!DOCTYPE html> 2 <html lang="en-US"> 3 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 6 <!-- <meta name="viewport" content="initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /> --> 7 <meta content="width=640,user-scalable=0" name="viewport" /> 8 </script> 9 <style> 10 html, 11 body, 12 * { 13 padding: 0; 14 margin: 0; 15 } 16 17 html, 18 body { 19 height: 100%; 20 } 21 22 #wrap, 23 #player { 24 height: 100%; 25 } 26 </style> 27 </head> 28 29 <body> 30 <div id="wrap"> 31 <div id="player"> 32 </div> 33 </div> 34 <script> 35 window.console2 = console; 36 </script> 37 // youku 的api 会重写console,导致console.log 失效,所以需要在引入youku api 之前备份console 对象 38 <script type="text/javascript" src="http://player.youku.com/jsapi"></script> 39 <script> 40 console.log(‘console‘); 41 console2.log(‘console2‘); 42 function setYKUPlayer(data) { 43 console.log(‘setYKUPlayer,data is:‘, data); 44 // client_id 和 styleid 可以忽略 45 var player = new YKU.Player(‘player‘, { 46 styleid: ‘1‘, 47 client_id: ‘7307ee0273158588‘, 48 vid: data, 49 }); 50 } 51 // http://v.youku.com/v_show/id_XMTQxMzM2MjA5Mg==_ev_1.html?from=y1.3-idx-uhome-1519-20887.205805-205902.1-1 52 // 在id_ 后面截取视频id:XMTQxMzM2MjA5Mg== 53 setYKUPlayer(‘XMTQxMzM2MjA5Mg==‘); 54 </script> 55 </body> 56 57 </html>
原文:http://www.cnblogs.com/pasico/p/5049424.html