未显示将Youtube视频嵌入到WebView(Appcelerator)中(黑屏)

编程入门 行业动态 更新时间:2024-10-13 18:20:33
本文介绍了未显示将Youtube视频嵌入到WebView(Appcelerator)中(黑屏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试在我的应用程序(Appcelerator,Android)中显示YT视频.我发现最好的方法是在WebView中显示嵌入的视频,因此我使用以下代码来实现:

I try to show YT video in my application (Appcelerator, Android). I found that the best way is to show embeded video in WebView, so I do it with such code:

var webView = Ti.UI.createWebView({ url: 'www.youtube/embed/LTRfmqc0KBg', enableZoomControls: false, scalesPageToFit: true, scrollsToTop: false, showScrollbars: false });

,但视频无法加载(我只能看到黑屏-而不是Webview的白屏). WebView可以正常工作,因为它可以显示其他页面.

but video does not load (I see only black screen - instead of webview's white). WebView works properly because it shows other pages.

推荐答案

然后您可以尝试

var Win = Titanium.UI.createWindow({ title : 'Video View Demo', backgroundColor : '#fff' }); var video_url = 'www.youtube/watch?v=bSiDLCf5u3s'; var movie = '<html><head></head><body style="margin:0"><embed id="yt" src="' + video_url + '" type="application/x-shockwave-flash" width="480" height="266"></embed></body></html>'; var webView = Ti.UI.createWebView({ top:0, left:0, width:480, height:266, url:video_url, html:movie }); Win.add(webView); Win.open();

更多推荐

未显示将Youtube视频嵌入到WebView(Appcelerator)中(黑屏)

本文发布于:2023-11-05 18:36:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561558.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:黑屏   视频   Youtube   Appcelerator   WebView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!