本文介绍了未显示将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)中(黑屏)
发布评论