Corona SDK - 尝试将非全屏视频显示到网络视图中

Corona SDK - Trying to have a video not in fullscreen into webview

我正在尝试将视频显示在网络视图中,而不是在 iphone 时全屏显示。 我已经阅读了在堆栈中找到的每个 post,但我仍然有问题。 在 ipad 中一切都很完美,但在 iphone 中则不然。 我认为这不能正常工作:

webView:setNativeProperty( "allowsInlineMediaPlayback", true )

这里是关于以下内容的文档:https://docs.coronalabs.com/api/type/NativeDisplayObject/setNativeProperty.html

我的lua代码:

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 )

还有我的 html 文件:

<!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>

我有一个正在运行的 objective-c 项目,但我无法让它与 corona 一起工作,也不使用 corona enterprise。 我希望有人能帮助我,或者告诉我除 https://coronalabs.com/blog/2014/03/18/tutorial-corona-enterprise-quickstart-ios/ 之外关于使用 Corona Enterprise 的其他信息。

非常感谢您的帮助,对不起我的英语。

费德丽卡

我通过 Corona Support 找到了解决方案。 他们是这么告诉我的:

Hello! Thanks for reporting this. For some mysterious reasons object:setNativeProperty and object:getNativeProperty is set up to work with dot syntax instead of object style calls. Basically, if you try to do webView.setNativeProperty( "allowsInlineMediaPlayback", true ), everything should work. (difference is "." instead of ":" ) This would be fixed in one of upcoming releases, but, we'll still support dot syntax for backwards compatibility reasons. Vlad.