How do I

0 favourites
  • 11 posts
  • how to stop audio of construct2 game running inside an iframe by click of close button of iframe

    My game is running inside iframe with audio playing but if I close iframe audio keeps playing in background. How to close audio when iframe is closed by click of button on iframe?

  • Are you talking about an iframe INSIDE of your project (using the html elements pack plugin) or is this an iframe running from the html page on a website with your project inside of it?

    ~Sol

  • Are you talking about an iframe INSIDE of your project (using the html elements pack plugin) or is this an iframe running from the html page on a website with your project inside of it?

    ~Sol

    Hi Friend,

    I have hosted game on some other webpage but that webpage is holding construct 2 game in inside iFrame. Now I have to place a close button on that iframe which closes game when clicked on close button(please note that browser won't be even closed only game will be closed). Here issue is if any audio is playing continiously in game and user click on close button of iframe , it closes iframe window but audio keeps playing in background . how to pause that audio on closing iframe.

  • Yeah, I have no idea what would be causing that or what the solution would be... maybe you need to have some code in the website itself to either change the URL of the iframe when it's closed to something that has no sound (like google.com) or some other method for muting the sound on the page (some javascript maybe?)

    Does this problem happen in all browsers? Maybe it's a browser specific issue?

    ~Sol

  • Yeah, I have no idea what would be causing that or what the solution would be... maybe you need to have some code in the website itself to either change the URL of the iframe when it's closed to something that has no sound (like google.com) or some other method for muting the sound on the page (some javascript maybe?)

    Does this problem happen in all browsers? Maybe it's a browser specific issue?

    ~Sol

    Yes this is the issue with all website

  • Wich site is it running ? I cant visualize it. Is it a close button from the site itself ? Is that 'thing' always on the same place (mouse wise) ? Can i see this site ?

  • Wich site is it running ? I cant visualize it. Is it a close button from the site itself ? Is that 'thing' always on the same place (mouse wise) ? Can i see this site ?

    Hi Friend,

    You are right. close button is from site. This site has an iframe holding construct game inside it. How to close the audio inside construct 2 game when I tap on close button of site? Currently that work has been removed from the site where I was working. But hope u understood my requirement. plz help me

  • Can't you stop the audio based on where the mouse is ? (corner). I know you can't do this based on touch.

  • Can't you stop the audio based on where the mouse is ? (corner). I know you can't do this based on touch.

    This code has to work on mobile only. Also I am not able to understand construct 2 code to control audio through external javascript. Can u help me in controling video/audio component using external js functions/commands for construct 2 games. I will be very greatful to you.

  • Well i am not a specialist at all, and certainly not in js codes. But i dont think that will help you. At the moment you close the iFrame, the inserted construct code is gone. I think. And you cant change the page that is embedding your code.

    Did you try the conditions in the browser plugin ? No luck ?

    On resized

    Page is visible

    On suspended

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well i am not a specialist at all, and certainly not in js codes. But i dont think that will help you. At the moment you close the iFrame, the inserted construct code is gone. I think. And you cant change the page that is embedding your code.

    Did you try the conditions in the browser plugin ? No luck ?

    On resized

    Page is visible

    On suspended

    Hi Friend,

    The iframe is running as overlay in the webpage so if I close the iframe, audio still keep playing. Also, page is invisible also doesn't bcz of same reason.

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