我正在使用 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];