javascript - win 8.1 Html audio continue play after app switched -


i wondering how let windows 8.1 app continue play music when app runs in background, it's js windows 8.1 store app.

and audio html tag:

<audio id="player" controls src="/1.mp3"></audio>

you can following,

a background audio declaration must in app manifest. in html can done as,

 <audio msaudiocategory="backgroundcapablemedia" controls="controls">  <source src="song.mp3"/>   </audio> 

the javascript equivalent of above

 function playaudio ()   {     // create new audio tag "backgroundcapablemedia" class     if(!audtag)      {       audtag = document.createelement('audio');       audtag.setattribute("id", "audtag");       audtag.setattribute("controls", "true");       audtag.setattribute("msaudiocategory", "backgroundcapablemedia");       audtag.setattribute("src", "song.mp3");       document.getelementbyid("scenario1output").appendchild(audtag);       audtag.load();     }     } 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -