Hi, How can we launch a youtube Video from our Application and once we press End or it finish get back to the game? I see right now that it go to youtube app...Do anyone uses an alternative moethod to play the youtube videos from the App?
I suspect you'd have to have a plug-in which would use one of the native video player controls and then have a callback function that get's called once the video has finished.
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@techdojo - sorry for the very long delay in posting my fork of the UIKit plugin to github. I'm still on sick leave from work. I'll try to do a cleanup of my code and post it to github in the next week.
If you're interested, you can check out the alterations of the UIKit plugin in action on this app: http://itunes.apple.com/app/melbtouring/id546591328?mt=8 ... it has the in-app email plugin functionality in there, plus a bunch of additions to the UIWebView functionality. A great colleague finished up the project when I was ill but the app is all Gideros with custom UIKit plugin.
The tableview performance is a bit sucky on a 3GS but performs great on iOS devices with a CPU comparable to iPad2. I'm sure with some work on optimization it can work much faster on a 3GS. It's a port of a codebase made originally in Objective-C and Three20 eg. http://itunes.apple.com/app/open-studios/id388416851?mt=8 ... Gideros gives me much more flexibility at the expense of some performance for things like custom UITableView layouts, but it's a good tradeoff.
@ianchia - no worries, I was actually thinking about this the other day Hope your feeling better.
The app looks really well polished - it's great to see Gideros being used for non-game apps as well.
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@IanChia - just a thought re the performance of your list view, are you creating the entire list at the start or just a portion of it. I have a pure lua custom listview control that contains over 600 rows each with a string and some graphics and I'm getting a rock solid 60fps on a 3rd gen iPod touch. The trick is to only render enough row's to fill the view and then reuse them as they go off the screen (that and try and limit the amount of garbage being generated!)
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@techdojo, Is it possible to share some code on how you do this? How do you render just enough and how do you make the list view scrolll? Tried it for days now but still not working ( Thanks in advance.
@DRS - Sorry at the moment I can't share the specifics (it's client code for an in-development app), I will be releasing it later once the app has been released. (hopefully before Christmas).
However most of the implementation is based on Gilbert's TableViewXL library in the Beer SDK community code section.
Basically - divide the screen height by the row height (+ a couple) to get the number of rows you actually need, then create a tableView that contains these row sprites, then add a touch, move and release listener to move the rows - think of them as a "window" on to the whole table, then as the row at the top or the bottom moves out of the window it's removed and re-inserted at the bottom or the top (depending on the scroll direction). What I did is ensure that the row is re-inserted at the correct place in the tableView child stack (hence the discussion about Sprite:addChildAt() elsewhere) so that they are always in the correct order.
When I create the table I pass in a custom callback that is responsible for actually rendering a row's content just before it comes into view - it takes (amongst others) the row number so it know's which you are trying to re-create.
What this means is that the actual rendering is spread out so that (normally) you'll only be re-rendering a new row, once every frame or so (depending on the scroll speed).
To speed up the rendering I pre-allocate a pool of Bitmaps (one per character) for each visible row (NOT one per table entry - that would be silly) based on the maximum number of characters per row I need and then the text printing just becomes a case of changing the associated bitmap region and position to simulate a line of text.
Simples...
Gilbert's code is pretty well written and fairly easy to read / follow - a bit light on the comments but hey, you can't have everything...
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
I'm not sure whether you have an answer for your original question about playing YouTube videos but my recent post on using BhWax to call out to ObjectiveC (if you are on iOS) allows this. Stolen straight from the BhWax demo program shown in the video, this method embeds a YouTube video at any chosen size:
function playVideo(url, x, y, width, height)local html =string.format("\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%s\" type=\"application/x-shockwave-flash\"\
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>", url, width, height)local videoView=UIWebView:initWithFrame(CGRect(x, y, width, height))
videoView:loadHTMLString_baseURL(html, nil)
getRootViewController():view():addSubview(videoView)end
Obviously, the url is a link to a given YouTube video.
@bowerandy - so let me get this straight, to embed a youTube video you create a template local html page that you squirt into a UIWebView (this I can understand), but what's this with the "type='application/x-shockwave-flash'", I thought anything flash related was persona-non-grata in Apples world?
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Huh ????what's this with the "type='application/x-shockwave-flash'", I thought anything flash related was persona-non-grata in Apples world?
@techdojo, yes I though that too. It's just a snippet I got off StackOverflow but, hey, it works! You can see it in the demo of that BhWax video I did.
Comments
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@techdojo - sorry for the very long delay in posting my fork of the UIKit plugin to github. I'm still on sick leave from work. I'll try to do a cleanup of my code and post it to github in the next week.
If you're interested, you can check out the alterations of the UIKit plugin in action on this app: http://itunes.apple.com/app/melbtouring/id546591328?mt=8 ... it has the in-app email plugin functionality in there, plus a bunch of additions to the UIWebView functionality. A great colleague finished up the project when I was ill but the app is all Gideros with custom UIKit plugin.
The tableview performance is a bit sucky on a 3GS but performs great on iOS devices with a CPU comparable to iPad2. I'm sure with some work on optimization it can work much faster on a 3GS. It's a port of a codebase made originally in Objective-C and Three20 eg. http://itunes.apple.com/app/open-studios/id388416851?mt=8 ... Gideros gives me much more flexibility at the expense of some performance for things like custom UITableView layouts, but it's a good tradeoff.
Best,
- Ian
Hope your feeling better.
The app looks really well polished - it's great to see Gideros being used for non-game apps as well.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
Is it possible to share some code on how you do this? How do you render just enough and how do you make the list view scrolll? Tried it for days now but still not working (
Thanks in advance.
However most of the implementation is based on Gilbert's TableViewXL library in the Beer SDK community code section.
Basically - divide the screen height by the row height (+ a couple) to get the number of rows you actually need, then create a tableView that contains these row sprites, then add a touch, move and release listener to move the rows - think of them as a "window" on to the whole table, then as the row at the top or the bottom moves out of the window it's removed and re-inserted at the bottom or the top (depending on the scroll direction). What I did is ensure that the row is re-inserted at the correct place in the tableView child stack (hence the discussion about Sprite:addChildAt() elsewhere) so that they are always in the correct order.
When I create the table I pass in a custom callback that is responsible for actually rendering a row's content just before it comes into view - it takes (amongst others) the row number so it know's which you are trying to re-create.
What this means is that the actual rendering is spread out so that (normally) you'll only be re-rendering a new row, once every frame or so (depending on the scroll speed).
To speed up the rendering I pre-allocate a pool of Bitmaps (one per character) for each visible row (NOT one per table entry - that would be silly) based on the maximum number of characters per row I need and then the text printing just becomes a case of changing the associated bitmap region and position to simulate a line of text.
Simples...
Gilbert's code is pretty well written and fairly easy to read / follow - a bit light on the comments but hey, you can't have everything...
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
You put me on the right track;-)
I'm not sure whether you have an answer for your original question about playing YouTube videos but my recent post on using BhWax to call out to ObjectiveC (if you are on iOS) allows this. Stolen straight from the BhWax demo program shown in the video, this method embeds a YouTube video at any chosen size:
best regards
@bowerandy - so let me get this straight, to embed a youTube video you create a template local html page that you squirt into a UIWebView (this I can understand), but what's this with the "type='application/x-shockwave-flash'", I thought anything flash related was persona-non-grata in Apples world?
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
best regards