2
在我的一個應用程序中,我必須在UITableviewcell中播放視頻,在一個單元格中播放一個視頻,當滾動UITableview和單元格隱藏視頻時應停止。我的項目在Objc。在UITableview單元中播放視頻
任何第三方的建議?
感謝在該小區提前
在我的一個應用程序中,我必須在UITableviewcell中播放視頻,在一個單元格中播放一個視頻,當滾動UITableview和單元格隱藏視頻時應停止。我的項目在Objc。在UITableview單元中播放視頻
任何第三方的建議?
感謝在該小區提前
使用的UIWebView,它會正常工作
NSString *baseUrl = @"http://www.youtube.com/embed/";
NSString *videoUrl = [NSString stringWithFormat:@"%@%@",baseUrl,embedCode];
videoUrl = [videoUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML,videoUrl, 300.0, 200.0];
UIWebView *videoWebView = [[UIWebView alloc] initWithFrame:CGRectMake(8, 10.0, width-16, (width-16)/1.8)];
[videoWebView setAllowsInlineMediaPlayback:YES];
videoWebView.mediaPlaybackRequiresUserAction = YES;
videoWebView.scrollView.scrollEnabled = NO;
videoWebView.scrollView.bounces = NO;
[videoWebView loadHTMLString:html baseURL:nil];
[self.contentView addSubview:videoWebView];
在UITableViewCell中播放視頻時,你使用的是什麼?是webview還是其他媒體播放器? –
好吧,我不確定任何第三方SDK。但你可以在SO上推薦這篇文章。 https://stackoverflow.com/questions/24825994/play-video-on-uitableviewcell-when-it-is-completely-visible –
@ R.Mohan我已經使用了一個第三方應用程序,但它創造了問題,所以即時通訊尋找另一個alternet –