How to turn off auto sleep ios in my website - ios

I have a website to play the game. When user plays the game in my web, the ios device auto sleep and turn off the screen then the game can't play anymore.
Do you know that and any idea for that?
Thanks so much!

I understand that you want to prevent the user's device to go to sleep when your game is open but the user doesn't touch the screen for a period of time.
There is no official support in iOS for this kind of feature.
NoSleep.js tries to offer some "hacky" way to keep the device awake, but according to it's issues it's not very reliable and clearly not future-proof.
If you want to have more control on the device consider the creation of a native app for your game.

Related

ios setting to neatly bypass iphone mute

I am working on an app that, among other things, provides alarms in emergencies. I would like to add a setting that will allow users to receive alarms with sound even if their phone is muted. As far as I am aware, this could be hacked by playing an mp3 through media services, as if the app was a music player left to play in the background, but that doesn't seem extremely kosher.
Does anyone know a 'neater' way to do this? Can I somehow allow my users to prioritise my app over the mute button?
Thank you very much.

Using the TTS Synthesizer in iOS when the app is ALREADY on the background

I would like to play a sound and use the AVSpeechSynthesizer to speak out some strings. The point is that I want these to happen when the device is already locked and then some events happen which triggers them.
I've found lots of info about how to play sound on the background, but this means that playback starts when the app is active and then the playback could continue, if the screen is being locked (after the start of playback). I've done all the tricks but can't hear a sound, which is triggered when the device is locked (and app is already on the background). However this works with iOS 8.3 simulator almost out-of-the-box, but not with a device.
So how to resolve this? Should I actually use some notification stuff to produce the desired outcome? I'm not too familiar with the notifications, so is there any other workarounds or is the notifications way easier than I think?
Cheers,
Mikko

How do I take a screenshot in a form of a video on my iPod touch 5G?

I have a YouTube channel which I post game reviews and best apps videos. I am currently using my old ipod to record but since I have quite a lot of subscribers I want the video quality to be better. Is there any app I can download to take a screen video on a non jailbroken iPod touch 5G.
You can share screen of your iPod to your desktop computer using AirPlay and record screencast from this computer. It will look like you recorded screen of your iPod. For this you will need anything like this: http://www.airsquirrels.com/reflector/record-iphone-screen/
Or you can try solution from Apple Support Community: https://discussions.apple.com/thread/4893020?start=0&tstart=0
They suggest following:
Get RecordMyScreen from emu4ios.weebly.com on your iPhone. Sroll down
untill you find RecordMyScreen then press install. When it asks if you
want to install the app press indtall. It may take more than one try,
so if it doesn't work the first time tap retry. I have it and it works
great.

how to share iOS game screen in real time?

I created a simple game on iPhone. I want to show my play in real time to my friend's iPhone through network.
Do you know any open source to implement the part?
Or, can you let me know which part I should study to implement it? open gl? cocoa 2d?
thank you.
AFAIK there's no such a think as screen sharing features on iOS and even if there were they would probably be prohibited by Apple. The only screen sharing feature there is is Air Play, which is available for developers to use, but this sharing is only done through an Apple TV. Check out this documents and see, however: Multiple Display Programming Guide for iOS and Air Play Overview.
If you want to make a multiplayer game (either when players play simultaniusly or a turn-based game) you should use the Game Center APIs instead of sharing a screen directly. Please check the Game Center Programming Guide.

iOS Background Audio in a Web App

I am writing a web app that uses HTML5 audio. I want to make sure that the user can move to a different application while still listening to the audio in the background. This works while the web app is still within Safari itself. However, when the user adds the web app to their homescreen and it has been set to allow for fullscreen access (no Safari toolbars), when they leave the app the audio does not continue to play. Does anyone know of any way to have a web app proceed while in the background?
Thanks.
I observe exactly the same thing. It's really puzzling as to why Safari, webkit on iOS I suppose really, handles it differently in the two cases.
I notice one thing that might be a small clue, when running as a home-screen'ed 'app' when you playback the audio the iOS status bar (at least on my ios4.1/iphone4) does NOT show playback indicator (blue triangle). But when using the site directly via Safari (and the sound stays in the backgroun as expected) it DOES show the playback indicator.
I think the only people who can probably answer your question are apple since it's their webkit implementation. If you haven't already I would urge you to take this up on the apple developer message boards.
For others not familiar the 'full screen access' Dan is referring to is a Safari specific meta tag that enables a bookmarked web page to open in safari 'full screen' without the location and menu bars.
While HTML5 is making progress on supporting device native features through HTML 5 APIs (such as accelerometers, etc) having true background audio seems like it hasn't really been spec'ed out yet. By background I mean when the browser is not the application that the user is currently focused on. It was only more recently that iOS even supported application multitasking which is what making the behavior from safari possible but it's a separate thing together to integrate that tightly with the OS'es native audio control features, which is what would need to happen.
This is not possible, at least not currently. You are playing the audio from the browser and when the browser closes the system kills the app, or freezes it, unless it has multi-tasking support(but that isn't allowed for web apps)
In iOS 5 and Android 4.0.3, putting a browser window to background does not stop playback. I am not sure about other versions prior to them.
You can do so with an iPhone 4. On my website, I posted a song with the simple html5 tag and I went on it with the iPhone 4. Played the song, left the app. Song runs in the background and there is even a play button on the top bar like when you listen to music on the iPod app.

Resources