Why does YouTube iframe not work on export? xcode

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Why does YouTube iframe not work on export? When I load a string of HTML content

    	<html>
    		<body>
    <iframe class="ytplayer" id="c3-video" 
     width="112" height="63"
     src="https://www.youtube.com/embed/HOWrYyslSYU?controls=0&disablekb=1&enablejsapi=1&fs=0&modestbranding=1&playsinline=1&start=10&color=white&iv_load_policy=3"
     frameborder="0" allow="autoplay; encrypted-media; allowsInlineMediaPlayback"
     style="border: solid 2px #37474F"
    </iframe>
    		</body>
    	</html>
    

    in the iframe (in this case the YouTube embedded player) it works in preview and HTML5 export. However, when I export using the xcode corvdova option, and after compiling the .ipa the player doesn't show up anymore nor loads at all. I'm using "playsinline=1" in my URL string which I read online it was necessary for non-fullscreen YouTube videos to work. Still no luck though.

    Also, in the error log on xcode I do see a lot of 'UIWebView deprecated' tags, maybe that has something to do with it? On YouTubes API website it talks about allowsInlineMediaPlayback must be set to true which I did set you YES in xcode I believe

    This talks about the youtube player using UIWebView - WKWebView. Honestly, I'm a bit confused what C3 is exporting for xcode though, I'm not the greatest coder

    Perhaps I need to include this? But I wouldn't know where to put it. This and This are equally helpful, to some extent, at this point I'm just trying a whole bunch of methods

    Ref: construct.net/en/forum/construct-2/how-do-i-18/avoid-auto-fullscreen-video-105189

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You're loading an iframe in an iframe, which is a redundant level of indirection and could be breaking things. Just point the iframe URL at the iframe src.

  • Thanks for the prompt reply :) The issue is that I want to make certain API calls using JS (browser plugin) however I'm not sure how to do that, say for example have the code below work without adding the necessary scripts within the frame

    	"document.getElementById(""c3-video"").contentWindow.player.playVideo();"
    
  • I just ran a test build using the URL component for the iframe and still had the same result. Again this works on preview, but not after exporting to a native IOS testflight app (nothing appears where the iframe should be)

    I am using C3 run time, no unofficial plugins, exporting through xcode, latest stable release

  • When you publish mobile apps generally you have to configure them to whitelist any kind of external network connections at all, otherwise it will all be blocked by default. I'm not sure what URLs you'd need to allow to permit YouTube video playback, it depends on their service.

  • Thanks for your help Ashley, I located the issue yesterday- it was a simple config change in the Cordova export! I had to change the default <access origin="blob:*" /> to <access origin="*" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)