Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 13    Views: 149

farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
06/15/13 04:47 AM (10 years ago)

Fix - HTML audio not stopping

Hi guys, I had this problem where the HTML5 audio player would not stop when navigating out of the screen natively on IOS. This is the fix: Go to your plugin .m file and insert the following code just before "@end" -(void) viewDidDisappear:(BOOL)animated{ [self initLoad]; } That's it. Looks easy but it drove me crazy. All credit for that solution goes to @Kittsy. Farcat
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
06/15/13 12:04 PM (10 years ago)
Awesome Fix! This too has been bugging me for a long, long time. Put this snippet at the end of the BT_screen_webview.m and now the Youtube video that just kept on playing in the background forever, and prevented new videos from playing is fixed. Thanks for sharing this Farcat, and big shoutout and thanks to Kittsy who strike again.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
06/15/13 01:34 PM (10 years ago)
This Kittsy dude is awesome I'm going to treat him to a beer right now. lol
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
06/15/13 01:43 PM (10 years ago)
Have offered before Lol! Still there if you want it...
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
06/15/13 02:40 PM (10 years ago)
It's a bit far to walk for a pint Rohan but if I'm every down there I'll take you up on it, there are a few I'm gonna look up, I'll be bladdered
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
06/16/13 11:18 AM (10 years ago)
Glad it helped you Rohan. Once again, Super-Kitssy saved the day! Farcat
 
NeoZAZMatt
I hate code!
Profile
Posts: 9
Reg: Aug 01, 2013
Orlando
6,340
like
08/15/13 09:27 AM (10 years ago)
Just ran into this problem last night, so happy to find this fix so quickly. Going to apply it tonight and try it out. Thanks!
 
NeoZAZMatt
I hate code!
Profile
Posts: 9
Reg: Aug 01, 2013
Orlando
6,340
like
08/17/13 08:52 PM (10 years ago)
I'm using the Simple RSS reader plug in to point to a feed with HTML5 Audio players in their posts. I can't figure out which .m file to put the code -(void) viewDidDisappear:(BOOL)animated{ [self initLoad]; } Almost all the .m files I've tried in the Simple RSS plug folder produces the warning "Instance menthod 'initLoad' not found (return type defaults 'id') Whether I get the warning are not, the mp3 files sometimes continue to play after closing the post windows and going back to the RSS feed screen. The audio pauses when I close out the app, but when I open the app again, it picks up where it left off. I did discover that this only happens is the audio is not already playing before I exit the screen. If I what for the audio to play, then exit - no problem. So I'm not sure if it's the player causing the issue and if anything can be done in the app with this code adjustment. I'm trying to make sure the audio doesn't play while not on that posts screen if that's at all possible with buzztouch files. Thanks!
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
08/17/13 09:19 PM (10 years ago)
If I remember correctly the rss passes to the web view class put the code in there it might not be in the rss folder
 
NeoZAZMatt
I hate code!
Profile
Posts: 9
Reg: Aug 01, 2013
Orlando
6,340
like
08/18/13 07:18 AM (10 years ago)
Thanks, I'll look around further outside that folder.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
08/18/13 08:34 AM (10 years ago)
I'll be back home near a computer in a few days if your still stuck I should be able to figure it out
 
MobileAppsABC
Aspiring developer
Profile
Posts: 28
Reg: Dec 19, 2012
Longueuil
4,480
like
08/27/13 09:00 AM (10 years ago)
Hi, I am using Custom Url plugin to view Youtube playlist, it work fine with iPhone, but with iPad the HTML5 audio player would not stop when navigating out of the screen with nav bar "LeftButton" . I try this fix from @Kittsy: Go to your plugin .m file and insert the following code just before "@end" -(void) viewDidDisappear:(BOOL)animated{ [self initLoad]; } Now, it OK with the iPad but the video do not play on the iPhone. Any solutions for this sound stop bug !! That will work for iPad and iPhone.
 
pulverdingen
I hate code!
Profile
Posts: 89
Reg: Jan 04, 2012
pulverdingen
890
like
03/27/14 04:01 AM (10 years ago)
Hmmmmm I tired this Go to your plugin .m file and insert the following code just before "@end" -(void) viewDidDisappear:(BOOL)animated{ [self initLoad]; } That's it. Looks easy but it drove me crazy. and it didn't work, same thing, the audio just keeps playing and playing. I put this is the BT_screen_customHTML.m right before the @end argh !!!
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
04/27/14 09:07 AM (10 years ago)
running into this with a new plugin and did some research and saw this post- here's how I've been fixing this in plugins, adding this code right before the @ end -(void) viewWillDisappear:(BOOL)animated { yourappname_appDelegate *appDelegate = (yourappname_appDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate.audioPlayer stopAudio]; } That does render the Control Panel setting of stop on screen exit useless, but it is useless anyways and this stops the audio when you exit the screen.
 

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.