I’m trying to have a video shown into a webview and not in fullscreen when on iphone. I’ve read each post i’ve found on stack but i still have a problem. Everything is perfect in ipad but not in iphone. I think that this is not properly working:
webView:setNativeProperty( "allowsInlineMediaPlayback", true )
Here the documentation about:https://docs.coronalabs.com/api/type/NativeDisplayObject/setNativeProperty.html
My lua code:
local webView = native.newWebView( display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight ) webView:setNativeProperty( "allowsInlineMediaPlayback", true ) webView:setNativeProperty( "mediaPlaybackRequiresUserAction", false ) webView:request( "example\_full.html", system.ResourceDirectory ) local function webViewListener(event) if event.type then print( "The event.type is " .. event.type ) -- print the type of request if (event.type == "other") then if event.url == "js-call:myEvent" then print("ciao") webView:removeSelf() webView = nil end end end if event.errorCode then native.showAlert( "Error!", event.errorMessage, { "OK" } ) end end webView:addEventListener( "urlRequest", webViewListener )
And my html file:
\<!DOCTYPE html\> \<html\> \<head\> \<title\>HTML5 InStream Ad Framework - Simple Video Page\</title\> \<script type="text/javascript" src="instreamapi-2.1.2.min.js"\>\</script\> \</head\> \<body\> \<div style="position:relative"\> \<video id="vid1" width="100%" height="100%" style="background-color:black" poster="http://cdn.smartclip.net/html5framework/smartclip\_multisreen.png" controls url="" playsinline webkit-playsinline\> \<source src="media/bbb\_trailer\_iphone.mp4" type="video/mp4"/\> \<source src="media/bbb\_trailer\_iphone.ogv" type="video/ogg"/\> \<source src="media/bbb\_trailer\_iphone.webm" type="video/webm"/\> \</video\> \</div\> \<script type="text/javascript" language="javascript"\> window.onload = (function () { var myAdConfig = { preroll: 'http://des.smartclip.net/ads?t=de&p=9372&pl=testc&test=ms\_vast2\_socialmenu&sz=400x320&rnd=[random]', overlayDelay:3, overlayDuration:25, adCountdownText:'This ad remains [time] seconds', onFinish: function() { //console.log("ciao"); //window.location = "js-call:myObjectiveCFunction" window.location.href = "js-call:myEvent"; } } $ad('vid1', myAdConfig).start(); }); \</script\> \</body\> \</html\>
I’ve a working objective-c project, but i’m not able to let it work with corona neither using corona enterprise. I hope that someone can help me, or tell me something else than https://coronalabs.com/blog/2014/03/18/tutorial-corona-enterprise-quickstart-ios/ about using Corona Enterprise.
Maybe helping me to use it to let everything work properly.
Thanks a lot for your help and sorry for my english.
Federica