AaronSmithUK's Forum Posts

  • I recently experienced this problem, all my apps on UWP no longer play any sounds. I traced the problem to this line of javascript in the c2runtime:

    useOgg = !!(new Audio().canPlayType('audio/ogg; codecs="vorbis"'));

    It looks like if your windows installation has the audio pack that supports .ogg the audio system attempts to use .ogg audio files. However, the default export for c2 UWP projects is to use .m4a. So, what is happening is the the .ogg is not present and so we get 404 errors which silently error and send an empty sound data array to the audio decoder.

    It should be fixed if you add the .ogg versions of your audio files to the exported media library.

  • This used to work in VS2015, I havn't tested it in VS2017

    To launch app in full screen, add this to top of c2runtime.js:

    var ViewManagement = Windows.UI.ViewManagement;

    var ApplicationViewWindowingMode = ViewManagement.ApplicationViewWindowingMode;

    var ApplicationView = ViewManagement.ApplicationView;

    ApplicationView.preferredLaunchWindowingMode = ApplicationViewWindowingMode.fullScreen;

  • I got around this by creating a new project in Visual Studio 2017:

    New Project > JavaScript > Windows Universal > Blank App (Universal Windows)

    Then export from C2 Windows Store - Windows 10, VS 2015.

    Open the folder with the exported files.

    Copy and paste everything from the export folder into the root of the new VS 2017 project EXCLUDING:

    package.appxmanifest

    the .jsproj file

    the .sln file

    Seems to run okay, although I didn't do any extensive testing.

  • To use the WindowsStoreProxy.xml file, first locate it from here: C:\Users\<username>\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml (adjust to your local machine).

    Then paste it into the Windows project at the root - drag it onto the project node on the solution explorer - should be "YourGreatGame (Universal Windows)".

    To add IAPs to the file, you just need to add them as Product nodes. Here's a working example of a WindowsStoreProxy.xml with one IAP called CompleteUnlock with a price of £1.49. Remember to export Construct 2 with IAP in "test" mode.

    <?xml version="1.0" encoding="utf-16" ?>

    <CurrentApp>

    <ListingInformation>

    <App>

    <AppId>00000000-0000-0000-0000-000000000000</AppId>

    <LinkUri>http://apps.microsoft.com/webpdp/app/00000000-0000-0000-0000-000000000000</LinkUri>

    <CurrentMarket>en-US</CurrentMarket>

    <AgeRating>3</AgeRating>

    <MarketData xml:lang="en-us">

    <Name>AppName</Name>

    <Description>AppDescription</Description>

    <Price>1.00</Price>

    <CurrencySymbol>$</CurrencySymbol>

    <CurrencyCode>USD</CurrencyCode>

    </MarketData>

    </App>

    <Product ProductId="CompleteUnlock" LicenseDuration="0" ProductType="Durable">

    <MarketData xml:lang="en-us">

    <Name>Product1Name</Name>

    <Price>1.49</Price>

    <CurrencySymbol>£</CurrencySymbol>

    <CurrencyCode>GBP</CurrencyCode>

    </MarketData>

    </Product>

    <Product ProductId="2" LicenseDuration="0" ProductType="Consumable">

    <MarketData xml:lang="en-us">

    <Name>Product2Name</Name>

    <Price>1.00</Price>

    <CurrencySymbol>$</CurrencySymbol>

    <CurrencyCode>USD</CurrencyCode>

    </MarketData>

    </Product>

    </ListingInformation>

    <LicenseInformation>

    <App>

    <IsActive>true</IsActive>

    <IsTrial>false</IsTrial>

    </App>

    <Product ProductId="CompleteUnlock">

    <IsActive>false</IsActive>

    </Product>

    </LicenseInformation>

    <ConsumableInformation>

    <Product ProductId="2" TransactionId="00000000-0000-0000-0000-000000000000" Status="Active" />

    </ConsumableInformation>

    </CurrentApp>

  • Hi

    I've been looking at this also, but on IOS.

    User Media uses the HTML5 text to speech API. Example:

    var utterance = new SpeechSynthesisUtterance('Hello world');

    window.speechSynthesis.speak(utterance);

    This works fine on Safari on iPhone and iPad as standalone javascript. However, once it is compiled via Cordova (PhoneGap) it doesn't work.

    It doesn't produce an error, and debug shows that window.speechSynthesis is an object. But the call to .speak doesn't produce sound. I attached it to a user interaction (e.g. click a button to .speech) in case it required user interactivity, still no joy.

    I tried using the Cordova TTS plugin instead but it clashed with the Construct 2 audio system.

    Once I've looked into this more I'll update this post with my findings.

    Good luck!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Problem Description

    If a video is played in IOS Safari, then an audio is played, the audio is distorted. May relate to the well known sample rate bug from last year. Tested with Safari on an iphone 5s with ios 10 and an ipad mini with ios 9.

    Attach a Capx

    https://www.brightware.co.uk/construct2 ... rtion.capx

    Description of Capx

    The capx has a button to play an audio file (short sound effect) and a button to play a short video (mp4). Press the "Play Sound" button and the sound will play fine. Press the "Play Video" button and the video will play. Wait for the video to finish (about 4 seconds). Press the "Play Sound" button again and the audio will be distorted. If you reload the browser, the bug goes away. If you close the tab, start a new one, the bug returns.

    Steps to Reproduce Bug

    • Press the "Play Sound" button. Wait for the sound to finish. It should sound fine. Press it repeatedly.
    • Press the "Play Video" button and the video will play. Wait for the video to finish (about 4 seconds).
    • Press the "Play Sound" button again and the audio will be distorted.
    • If you reload the browser, the bug goes away. If you close the tab, start a new one, the bug returns.

    Observed Result

    Audio becomes distorted after video playback.

    Expected Result

    Audio should not be distorted.

    Affected Browsers

    • IOS 10 Safari iphone 5s
    • IOS 9 Safari ipad mini 1

    Operating System and Service Pack

    Win 10 Pro

    Construct 2 Version ID

    239 (64 bit)

    Hi

    I've got inline video working on iPhone ios 10 and iPad mini ios 9 (Cordova/PhoneGap).

    I had to edit the default construct 2 video plugin: C:\Program Files\Construct 2\exporters\html5\plugins\video\runtime.js

    Look for this.video.setAttribute("webkit-playsinline", "");

    And beneath it add: this.video.setAttribute("playsinline", "");

    Then, move both lines out of the if statement "if (this.useDom)" - put them above it. This is because ios 9/10 is now drawing the video to the canvas rather than using the dom. This means that you can now add objects on top of the video as it is being drawn on the canvas itself.

    To make this work on Cordova I also had to add this setting to config.xml:

    <preference name="AllowInlineMediaPlayback" value="true" />

  • Simplest way to get Construct 2 games onto ipad is export as web app, open Safari on ipad, navigate to game, "Add to Home Screen". Very simple.

    https://www.scirra.com/tutorials/43/mak ... onstruct-2

  • radbrothers - if you can confirm my fix worked I'll file a bug along with the fix.

  • Hi, yes it's easy enough. Open C:\Program Files\Construct 2\exporters\html5\plugins\iap\runtime.js - find the function - "Windows8Store.prototype.purchaseProduct" replace it with the version I specified above. Do the same for function: "Windows8Store.prototype.requestStoreListing". You might need to open the file as admin in notepad or whatever editor as it's in the program files. Restart Construct 2, export to Windows - it should export a c2runtime.js with the alterations. Basically it means that when your app runs in Windows (not in test mode) it won't crash and so can pass certification. When it's passed certification and your iap is live, it should work just fine.

  • You could apply the try catch fixes I specified in the iap file:

    C:\Program Files\Construct 2\exporters\html5\plugins\iap\runtime.js

  • Just picking up on an earlier issue about ios playback of audio needing a touch to start. To get round this add your audio track as a "Sound" rather than "Music" and it will autoplay on startup without needing a touch. Exported via Visual Studio TACO to .ipa. Works just fine on my iphone 5s ios 10 and ipad mini 1 ios 9. Seems ok with full music tracks, also cures the same problem on android.

  • Regarding your problem with Visual Studio crashing when not in "test" mode basically the call to IAP fails and takes out the runtime. I fixed this by altering my non-compressed c2runtime.js so that the calls to the windows IAP are wrapped in try catch statements. Not ideal, but got me through the problem!

    Windows8Store.prototype.purchaseProduct = function (product_) {

    if (product_ === "app") {

    this.purchaseApp();

    return;

    }

    var self = this;

    try {

    var productLicenses = this.currentApp["licenseInformation"]["productLicenses"];

    this.currentApp["requestProductPurchaseAsync"](product_, false).then(

    function () {

    if (productLicenses["hasKey"](product_) && productLicenses["lookup"](product_)["isActive"]) {

    console.log("[Construct 2] Product '" + product_ + "' purchased OK");

    if (self.onpurchasesuccess)

    self.onpurchasesuccess(product_);

    }

    else {

    console.log("[Construct 2] Product '" + product_ + "' purchase failed (cancelled?)");

    if (self.onpurchasefail)

    self.onpurchasefail(product_, "failed");

    }

    },

    function (msg) {

    console.log("[Construct 2] Product '" + product_ + "' purchase failed: " + msg);

    if (self.onpurchasefail)

    self.onpurchasefail(product_, msg);

    });

    } catch (e) {

    console.log("[Construct 2] Product '" + product_ + "' purchase failed - server not available");

    if (self.onpurchasefail)

    self.onpurchasefail(product_, "purchase failed - server not available");

    }

    };

    Windows8Store.prototype.restorePurchases = function () {

    };

    Windows8Store.prototype.requestStoreListing = function () {

    var self = this;

    try {

    this.currentApp["loadListingInformationAsync"]().then(

    function (listing) {

    console.log("[Construct 2] Listing information loaded");

    self.appName = listing["name"];

    self.appFormattedPrice = listing["formattedPrice"];

    self.lastProductListings = listing["productListings"];

    if (self.onstorelistingsuccess)

    self.onstorelistingsuccess();

    });

    } catch (e) {

    if (self.onstorelistingfail)

    self.onstorelistingfail();

    }

    };

  • Thanks. In the end I've dumped the IAP for the Amazon App version for now.

  • Alternatively you can use Visual Studio Community with Tools for Apache Cordova (all for free).

    https://www.visualstudio.com/vs/community/

    https://taco.visualstudio.com/en-us/doc ... e-cordova/

    Create a Javascript Cordova project in VS, paste the file output from Construct 2 into the www folder in the new project - and you're pretty much there.

    I've used this setup to launch on Google Play, Amazon App Store, App Store (Apple), and Windows Store (for what it's worth!)