Advertisement
Guest User

Youtube function call UIWebView ANE

a guest
Dec 22nd, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.39 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html><head>
  3. <META http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  4. <style>body{margin:0px;}</style>
  5. </head>
  6. <body>
  7.  
  8.     <!-- 1. The <div> tag will contain the <iframe> (youtube video player) -->
  9.     <div id="player"></div>
  10. <script>      
  11.       // 2. This code loads the IFrame Player API code asynchronously.
  12.       var tag = document.createElement('script');
  13.       tag.src = "http://www.youtube.com/player_api";
  14.       var firstScriptTag = document.getElementsByTagName('script')[0];
  15.       firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  16.  
  17.       // 3. This function creates an <iframe> (and YouTube player) after the API code downloads.
  18.       var player;
  19.       var vid;
  20.  
  21.       function setVid(params){
  22.          var obj = JSON.parse(params);
  23.          vid = obj.id
  24.       }
  25.  
  26.       function onYouTubePlayerAPIReady() {
  27.         player = new YT.Player('player', {
  28.           width: '480',
  29.           height: '280',
  30.           videoId: vid,
  31.           events: {
  32.             'onReady': onPlayerReady}
  33.         });
  34.       }
  35.  
  36.       // 4. The API will call this function when the video player is ready.
  37.       // using playVideo() is forbidden in Safari mobile browser as well as StageWebView
  38.       function onPlayerReady(event) {
  39.         event.target.playVideo();
  40.       }
  41. </script>
  42.  
  43. </body>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement