该<video>标签autoplay="autoplay"属性在Safari精品工程.
在iPad上进行测试时,必须手动激活视频.
我认为这是一个加载问题,所以我运行循环检查媒体的状态:
videoPlay: function(){
var me = this;
console.log('STATE: ' + $("#periscopevideo").get(0).readyState);
if ($("#periscopevideo").get(0).readyState != 4){
setTimeout(function(){me.videoPlay();}, 300);
}
else {
$("#periscopevideo").get(0).play();
}
}
Run Code Online (Sandbox Code Playgroud)
该州仍然在0iPad上.在我的桌面游猎,它经历0,1最后4.在iPad上,只有4在我手动点击"播放"箭头时才会到达.
此外,$("#periscopevideo").get(0).play()通过点击通话onClick也可以.
Apple对自动播放有任何限制吗?(顺便说一句,我正在运行iOS 5+).
在我的应用程序中,我有一个按钮,当按下该按钮时,可以让您观看YouTube视频(电影预告片).在应用程序内,没有启动safari.您可以在下面看到代码段.这个代码在iOS5下运行正常.但是,在iOS 6中,findButtonInView中的UIButton始终为nil.任何想法可能是什么原因?
youtubeWebView.delegate = self;
youtubeWebView.backgroundColor = [UIColor clearColor];
NSString* embedHTML = @" <html><head> <style type=\"text/css\"> body {background-color: transparent; color: white; }</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@?version=3&app=youtube_gdata\" type=\"application/x-shockwave-flash\"width=\"%0.0f\" height=\"%0.0f\"></embed></body></html>";
NSURL *movieTrailer;
if(tmdbMovie) movieTrailer = tmdbMovie.trailer;
else movieTrailer = [NSURL URLWithString:movie.trailerURLString];
NSString *html = [NSString stringWithFormat:embedHTML,
movieTrailer,
youtubeWebView.frame.size.width,
youtubeWebView.frame.size.height];
[youtubeWebView loadHTMLString:html baseURL:nil];
[self addSubview:youtubeWebView];
- (void)webViewDidFinishLoad:(UIWebView *)_webView {
isWatchTrailerBusy = NO;
[manager displayNetworkActivityIndicator:NO];
//stop the activity indicator and enable the button
UIButton *b = [self findButtonInView:_webView];
//TODO this returns null in case of …Run Code Online (Sandbox Code Playgroud)