gpt4 book ai didi

ios - 应用程序内部的 Youtube 视频播放器(在 webview 本身内部播放)

转载 作者:行者123 更新时间:2023-11-29 03:45:55 25 4
gpt4 key购买 nike

我正在尝试在应用程序内制作Youtube视频播放器(在webview本身内播放视频)。是否有任何基于此的教程或任何示例程序?

提前致谢。

最佳答案

您可以将 YouTube 视频嵌入到 Web View 中,如下所示:

- (void)embedYouTubeInWebView:(NSString*)url theWebView:(UIWebView *)aWebView {     

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, url, aWebView.frame.size.width, aWebView.frame.size.height];

[aWebView loadHTMLString:html baseURL:nil];
}

关于ios - 应用程序内部的 Youtube 视频播放器(在 webview 本身内部播放),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17761063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com