YouTube Webview Problem
I am using the 1.3.2 SDK and in order to play youtube videos I am doing the following.
- Creating a HTTP Client and getting JSON data for videos
- Using the results to create an embed code for the video, which is wrapped in html and body tags.
- Creating a webview and setting the html to the embed code in the following way:
var webview = Ti.UI.createWebView({
title:'Videos'+index,
html: embedCode,
height:50,
width:100,
top:5,
left:195
});
However, when I add the webview to the row in my table, I don't get anything, and if I check the webview.html, it returns as <html></html>
and I have no idea how to get it to work.
Anybody have any ideas?
1 Answer
-
Accepted Answer
This works only on device. The emulator cannot open youtube videos.
The code I use for this is:var movie= '<html><head></head> <body style="margin:0"> <embed id="yt" src="'+media_url+'" type="application/x-shockwave-flash" width="200" height="200"></embed> </body></html>';
of course this comes to html property, and media_url is the link to the video, something like this
http://www.youtube.com/watch?v=r70UpNT_ZUc