Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 6    Views: 167

pulverdingen
I hate code!
Profile
Posts: 89
Reg: Jan 04, 2012
pulverdingen
890
03/27/14 11:16 PM (6 years ago)

HTML Audio Player

Hi all, I have been having some issues. I have read the forums and have tried what had been suggested however I am still faced with the same issue.
I am using the HTML plugin, and have selected an audio file to play in the background. Though when I leave the page the file continues to play and yes I selected STOP playing when leaving the screen.....There has been some others who have had the same issue and I have tried what other people told them to do, but, still, here I am along with the music.....

I would rather have the ability to have a Audio player, where there are some controls instead of just a music file playing in the background, for you cannot even Pause...

These MP3's will be within the APP itself, No Streaming.......

I have heard of a HTML audio player.....Where is it????? Do I need to use the HTML PRO plug in???

Help..........STOP THE MUSIC !!!!!
 
pimentazores
Aspiring developer
Profile
Posts: 47
Reg: Mar 26, 2013
Barcelona
8,020
like
03/28/14 12:03 AM (6 years ago)
Hi Pulverdingen,

Not sure if it will help you or if this is what you need, but pls take a look here: https://www.buzztouch.com/forum/thread.php?tid=0DAA7A1F05FA0EA2DB0F277

Specially in 'onStart' and 'onResume' methods:

if(myMediaPlayer != null) {
BT_debugger.showIt(activityName + ":media player should be starting...");
myMediaPlayer.start();
}

And in 'onPause', onStop, and onDestroy methods:

if(myMediaPlayer != null){
if(myMediaPlayer.isPlaying()) myMediaPlayer.stop();
myMediaPlayer.release();
myMediaPlayer = null;
}


It worked for me!

Cheers
 
pimentazores
Aspiring developer
Profile
Posts: 47
Reg: Mar 26, 2013
Barcelona
8,020
like
03/28/14 12:05 AM (6 years ago)
Sorry, I've just assumed you're on android... Is that so?
 
pulverdingen
I hate code!
Profile
Posts: 89
Reg: Jan 04, 2012
pulverdingen
890
like
03/28/14 12:06 AM (6 years ago)
It seems that this is only about Android, should have mentioned it, I am running IOS...
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/28/14 01:08 AM (6 years ago)
odd… it 'should' stop.

If it doesn't, maybe you can paste this in your plugin class file, outside of other methods:

-(void) viewWillUnload {
yourapp_appDelegate *appDelegate = (yourapp_appDelegate *)[[UIApplication sharedApplication] delegate];
if(appDelegate.audioPlayer != nil){
[appDelegate.audioPlayer stopAudio];
}
}

replace 'yourapp' with whatever your actual app name is… 'should' work, but untested.

Cheers!

-- Smug
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
03/28/14 03:47 AM (6 years ago)
html audio uses browser features to play audio, which means you write the code in html and use one of the html plugins to play your audio. The basic feature isn't very fancy, but does the job.

http://www.w3schools.com/html/html5_audio.asp

If you google html audio player, you'll find code snippets that you can use which add controls and styles - there should be something out there that suits.

Alan
 
amysus
Lost but trying
Profile
Posts: 90
Reg: Oct 28, 2011
traveling the w...
3,650
like
06/08/16 04:00 PM (4 years ago)
I have just found Amazing Audio Player and that is working well for me in HTML. I know this thread is old, but in case others are stuck .... https://amazingaudioplayer.com
 

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.