Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 58

chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
12/18/12 01:10 PM (13 years ago)

AT53Video plugin and iphone going to sleep

I'm using the AT54Video plugin, however it has issues whenever the iPhone goes to sleep. Specifically, the video stops and when the iPhone is turned back on it starts over back at the beginning (after hitting play again). Is there a way to keep the video playing in the background, or to pause the video and resume where it left off?
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/19/12 08:46 AM (13 years ago)
Interesting. I don't recall anyone reporting the issue previously. Hard to imagine you're the first person watching a lengthy video using the plug-in, but who knows.... Longest locallay stored video I tested was about 25min because that's all the space I had. I did some checking on the class reference and mpmediaplayer should keep the phone alert when delivering video. But it looks likes people have been discussing the issue recently here on the Apple forums: https://discussions.apple.com/thread/4460391?start=0&tstart=0 Is this ios 6 you're experiencing this with?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 08:56 AM (13 years ago)
This came to me from a client who had it reported to them from a user. They are using audio clips. I was able to duplicate the issue using my iPhone 4s (v.5 OS). I then tested using a video clip on my iPhone and had the same issue. It goes to sleep after the normal time of inactivity - much less than 25 minutes. The user that apparentely reported the issue was using an iPhone as well - I don't know what model though.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 09:38 AM (13 years ago)
I tested on my iPad (ios 5 as well). The device doesn't seem to go to sleep automatically like it does on the iPhone. However, if I hit the power button, it does do the same thing (stops video and goes back to beginning, losing progress).
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
12/19/12 10:10 AM (13 years ago)
I used this plug-in on an app and I tested on a iPhone 3GS running 5.1.1 and a friends 4S (can't remember if he has 5.1.1 or 6.0). Both played the video (5 mins) to the end and the player keeps the phone awake. I can't tell you what to change, but at least you know there are combinations out there that do work OK. Audio clips are a completely different matter and you need a different approach for that - check out this thread, see if it helps? :- http://www.buzztouch.com/forum/thread.php?tid=5B7E76702DC6789D948E174
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/19/12 10:14 AM (13 years ago)
Does the audio contain video that displays something moving on the screen? Or are they just pushing the audio track thru an mp4 file utilizingthe plug-in? The only way the video would know to resume from a power off/screen lock is if it was acting as a backround service. Video generally doesn't work like that. Videos are likely meant by iOS to be the focus of the OS when playing. I would expect exiting or closing the app to terminate the video by design and you should have to re-start it if you launch the app again. That seems like standard iOS behavior. I say that because this would be overhead on the OS to keep a track marker of every video you watch so it can remember where you left off to resume there when you launch it again. Seems like there would be some code to add to your app delegate like you do with AVfoundation to handle the notifications/interruptions. There's no interruption handling code in that plug-in designed to work like a background/multitasking event. The screen locking while the video is playing - that does seem like unnatural behavior of ios I'd like to understand...
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 10:26 AM (13 years ago)
The audio is a mp3 file I believe. As for the video behavior, I wasn't really talking about exiting the app or even the screen. I simply meant pushing the lock button while the video is playing causes the issue. In contrast, watching a video in the Youtube app and pressing the lock button will pause the video, but allow for resume when the phone is turned back on.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/19/12 11:06 AM (13 years ago)
remember it's a VIDEO plug-in. So while there seems to be the potential to feed it mp3 files with no video, the code is not written or designed to work like that. the lock button is an interruption event. the plug-in code does not handle interruptions. you would need to modify it to behave that way. >> In contrast, watching a video in the Youtube app and pressing the lock button will pause the video, but allow for resume when the phone is turned back on. That's likely because the Youtube app is probably written and designed to work like that. They probably utilize interruptions in the code for the app. That's a nice feature, probably the highlight of that app IMO.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 11:14 AM (13 years ago)
Okay - thanks ATrain. I'll do some research to see what I can come up with about the interruption events. The audio file doesn't seem to be creating a problem by not being a video file. The plugin works great to handle both types the same. The issue of the iPhone going to sleep (which does seem to be something that needs to be addressed) is consistent on both audio and video files. I'll take a look at AlanMac's suggestion to see if that helps out. But from a cursory look, it seems that if it will help, it will do so only for the audio files. Maybe there's a way to adapt it for video as well? It's strange that some devices have the issue and some do not.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 11:18 AM (13 years ago)
Okay - I think I figured out the video issue. The "video" I was testing out was actually an audio file that had a still image displayed, packaged via Quicktime into a .mov and then converted to a .mp4 file. I just tried it using an actual video (with moving picture!) and it doesn't shut the screen off. So...it seems that the iPhone detects movement on the screen and uses that to determine whether to go to sleep or not? I'm thinking perhaps for the audio files the Audio Streamer plugin by Mark might be better suited. I'll have to buy that and give it a try.
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
12/19/12 12:17 PM (13 years ago)
cool. this is really the dilema with makign plug-ins. you write it to do a specific thing and then people use it to do other stuff. maybe it works, maybe it doesn't... How much support are we supposed to offer for 'mods' or 'unintended' use of the code, etc... This is why I held back putting any audio code together for the market. The features and options in the avfoundation/avtoolbox classes are just exhaustive and open to lots of modifications to make it work a specific way. PSMDanny is the author of that fantastic new Audio Streamer. The $4.99 price tag is an absolute STEAL. It would be a bargain at $49.99 based on how extensive his work and use of the ios audio classes are in that code. Buy it and use it, you will be far from disapointed, it'a gorgeous piece of work :) I have something else I found recently I meant to send you as well that I think you'll find really interesting. Check your PM. dhoh PM still disabled - send me an email, my email address is in the plugin screen congfig/readme.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 12:23 PM (13 years ago)
Thanks - And you're right - it was Danny! Look forward to what you have to show me. Chris
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
12/19/12 01:55 PM (13 years ago)
I just purchased PSMDanny's plugin and tried it out. Looks like it is having the exact same issue. I sent him an email asking about it. Chris
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.