菜鸟教程小白 发表于 2022-12-11 19:44:20

ios - 在 UITableview Cell 中播放视频


                                            <p><p>在我的一个应用程序中,我必须在 UITableviewcell 中播放视频,一次在一个单元格中播放一个视频,并且当滚动 UITableview 和单元格隐藏视频时应该停止。我的项目在 Objc 中。</p>

<p>对任何第三方有什么建议吗?</p>

<p>提前致谢</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>在该单元格中使用 UIWebView,它会正常工作</p>

<pre><code> NSString *baseUrl = @&#34;http://www.youtube.com/embed/&#34;;
    NSString *videoUrl = ;
    videoUrl = ;
    NSString *embedHTML = @&#34;\
    &lt;html&gt;&lt;head&gt;\
    &lt;style type=\&#34;text/css\&#34;&gt;\
    body {\
    background-color: transparent;\
    color: white;\
    }\
    &lt;/style&gt;\
    &lt;/head&gt;&lt;body style=\&#34;margin:0\&#34;&gt;\
    &lt;embed id=\&#34;yt\&#34; src=\&#34;%@\&#34; type=\&#34;application/x-shockwave-flash\&#34; \
    width=\&#34;%0.0f\&#34; height=\&#34;%0.0f\&#34;&gt;&lt;/embed&gt;\
    &lt;/body&gt;&lt;/html&gt;&#34;;
    NSString *html = ;
    UIWebView *videoWebView = [ initWithFrame:CGRectMake(8, 10.0, width-16, (width-16)/1.8)];
    ;
    videoWebView.mediaPlaybackRequiresUserAction = YES;
    videoWebView.scrollView.scrollEnabled = NO;
    videoWebView.scrollView.bounces = NO;
    ;
    ;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在 UITableview Cell 中播放视频,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/44172987/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/44172987/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在 UITableview Cell 中播放视频