native.newVideo() and native.newWebView()

Where’s the API description for native.newVideo() and native.newWebView() ? [import]uid: 10141 topic_id: 20651 reply_id: 320651[/import]

If you look at the video and pause it, you can guess a few things :slight_smile:

Jürgen [import]uid: 19590 topic_id: 20651 reply_id: 81059[/import]

:slight_smile: lol, thanks for the tip :slight_smile: [import]uid: 10141 topic_id: 20651 reply_id: 81060[/import]

A really exciting feauture, but how to use it??? guessing doesnt do the trick for me…

any ideas?

thx!

[import]uid: 116063 topic_id: 20651 reply_id: 81080[/import]

Well, for native.newWebView I’ve found out it’s like this:

object = native.newWebView(x,y,width,height) object:request("http://www.google.com")

For native.newVideo I don´t know yet [import]uid: 10141 topic_id: 20651 reply_id: 81132[/import]

Sorry guys, but what`s the main difference between the old [lua]native.showWebPopup[/lua] for the new one [lua]native.newWebPopup[/lua]? :\
Is there any official doc about it?
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20651 reply_id: 81142[/import]

Also note that

display.remove(myWebView)
myWebView = nil
or
native.cancelWebView()
myWebView = nil

does not work but

myWebView:removeSelf()
myWebView = nil
does remove it.
[import]uid: 13560 topic_id: 20651 reply_id: 81146[/import]

WebView seems faster but it crashes my app after 30 sec so I’ll stick with webPopUp until it’s more stable or we get a proper intro to the API. [import]uid: 13560 topic_id: 20651 reply_id: 81147[/import]

webPopUp is terribly unstable for me. I need to test webView better to see if it crashes like webPopUp or not [import]uid: 10141 topic_id: 20651 reply_id: 81148[/import]

Anyone got some code examples for the new native video or a way of retrieving them ???

[import]uid: 87151 topic_id: 20651 reply_id: 81221[/import]

@lano78

Yes webView crashes my app also.

using with director

  
webView = native.newWebView(0,0,410,270)  
webView:request(params.webURL)  
localGroup:insert( webView )  
  

crashes app after closing/changing scene…

waiting for offical docs… [import]uid: 96683 topic_id: 20651 reply_id: 81246[/import]

Well, native object does not work in groups so that may be your problem. How ever, I noticed that some objects can be inserted but will cause the app to crash after a while even though they will not give an error in the terminal. Maps are one of them and webView is another. [import]uid: 13560 topic_id: 20651 reply_id: 81253[/import]

Tried this, but crashed on the device and gave a tons of error message in the simulator. [import]uid: 19297 topic_id: 20651 reply_id: 81300[/import]

Yeah, my basic attempts seem to crash as well.

Though we’re all just guessing on the use. I think a quick post from someone at ansca would be super nifty. I know they love the big blog posts … but we’re cutting edgers here, darn it! :wink: :slight_smile: :smiley:
[import]uid: 13859 topic_id: 20651 reply_id: 81429[/import]

I’ve got native.newWebView() working without any crashes or errors and am able to switch between scenes and back with no problems. You just need to make a few tweaks to how you normally do things.

To create your webview, do as Taruga did and use this

myWebView = native.newWebView(x,y,width,height)  
myWebView:request("http://www.google.com")  

Do NOT insert your object into any scenes or displayGroups, if you do, that is where you get the crash when switching scenes.

Then where ever you have your localGroup:removeSelf() (or whatever you called your group/scene) add this to it.

myWebView:removeSelf()  
myWebView = nil  

Just like Lano78 mentioned [import]uid: 69700 topic_id: 20651 reply_id: 81583[/import]

Now, it would be absolutely awesome if we can get rid of that gray screen when the webview is loading (same behavior of the old webpopup).
I mean, it’s the basic, main problem with the webviews in corona…

UPDATE: Wow! There’s a fix with the new method! Set alpha to 0 just after creating the webview and then use transition.to to increase the alpha value… now, is there also a listener to detect when the page has been loaded, right? :slight_smile: [import]uid: 9158 topic_id: 20651 reply_id: 81599[/import]

I did some tests with the native.newWebView and an important difference with the old showWebPopup is that with the new method you can animate, move, rotate and change alpha of the webview object… that’s pretty cool.

Just try running this code

object = native.newWebView(0,0,200,200)  
object:setReferencePoint(display.CenterReferencePoint)  
object.x=display.contentCenterX  
object.y=display.contentCenterY  
object:request("http://www.google.com")  
  
function animate()  
object.rotation=object.rotation+1  
end  
  
timer.performWithDelay(10,animate,0)  

(you have to build for xcode simulator or device)

Can’t wait to see the full API!

Ops… I found out only now about the blog post… Sorry for the old news :slight_smile: [import]uid: 9158 topic_id: 20651 reply_id: 81598[/import]

I’ve finally got this working, and was hopefull that by changing the width or height of the WebView, I could expose a corona object (custom button, w.e.) that could be used to close the page but no joy.

How can I close the page. I am linking to a couple other pages of people that helped, and not all of them use a standard http://www.website.com/index.html so I cannot use an “object” html tag (only works with fully qualified link) to encapsulate a page within a page to have an html “close” button.

This would be perfect if i could just use close the page with a button in my game… [import]uid: 21331 topic_id: 20651 reply_id: 86245[/import]