2013-10-04 82 views
0

我使用uiwebview播放嵌入的youtube視頻,但今天突然它停止工作任何人都知道工作?在uiwebview中嵌入youtube視頻不再有效

NSString* videoHTML = [NSString stringWithFormat:@"\ 
         <html>\ 
         <head>\ 
         <style type=\"text/css\">\ 
         iframe {position:absolute; top:50%%; margin-top:-130px;}\ 
         body {background-color:#000; margin:0;}\ 
         </style>\ 
         <script type=\"text/javascript\" src=\"https://www.youtube.com/player_api\"></script>\ 
         <script>\ 
         var player;\ 
         function onYouTubeIframeAPIReady() {\ 
         player = new YT.Player('player',{ events: {\ 
         'onReady': onPlayerReady}\ 
         });}\ 
         function onPlayerReady(event) {\ 
         setTimeout(function() {\ 
         event.target.playVideo();\ 
         }, 1000);\ 
         }\ 
         </script>\ 
         </head>\ 
         <body>\ 
         <iframe class=\"youtube-player\" background-color:#000000 allowtransparency= \"true\" type=\"text/html\" width=100%% height=240px src=\"http://www.youtube.com/embed/%@?fs=1&autoplay=1&rel=0&version=3&enablejsapi=1&showinfo=0\" frameborder=\"0\" allowfullscreen/>\ 
         </body>\ 
         </html>",self.videoID]; 
[self.webView loadHTMLString:videoHTML baseURL:nil]; 
[webView setAllowsInlineMediaPlayback:YES]; 

回答

0

我改變了整個HTML只reffere到YouTube網站

1

更改/嵌入/ ...到/ V/...它會正常工作。

+0

感謝答覆的移動版它沒有爲我工作,所以我改變了整個HTML只reffere到YouTube網站的手機版 – mazzica1