You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/06/22 00:39:28 UTC

[GitHub] [cordova-plugin-media] pliniofm opened a new issue #239: MIDI file does not stop in background

pliniofm opened a new issue #239: MIDI file does not stop in background
URL: https://github.com/apache/cordova-plugin-media/issues/239
 
 
   <!--
   Please have a look at the issue templates you get when you click "New issue" in the GitHub UI.
   We very much prefer issues created by using one of these templates.
   -->
   
   ### Issue Type
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [ ] Bug Report
   - [ ] Feature Request
   - [X] Support Question
   
   ## Description
   
   I am trying to pause/stop the music when my app has been gone to background or the screen has been locked. Yes, I want different from the majority. I don't want to bother the user if my app is not in foreground. I am using a MIDI file. I've just had compiled for Android (I have no iOS device). This issue is not new (I've had it for a while). 
   
   I am using cordova-plugin-media v5.0.2. 
   
   Can anyone help me? 
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   I tried to use `playAudioWhenScreenIsLocked` parameter, but it is an iOS parameter, not for Android. 
   
   ```
   var mainMusic = null;
   function playMusic() {
   	if (typeof Media != "undefined") {
   		console.log('[Main Music] iniciar. musicaLigada = ' + musicaLigada);
   		mainMusic = new Media('cdvfile://localhost/assets/www/sound/game.mid', 
   			function() {
   				console.log('[Main Music] play again. isMusicOn = ' + isMusicOn);
   				if (mainMusic != null) {
   					mainMusic.play({ playAudioWhenScreenIsLocked : false });
   					mainMusic.setVolume(isMusicOn == '1' ? 1.0 : 0.0);
   				}
   			}, 
   			function (err) {
   				console.log('[Main Music] Media error: ' + err.code + ': ' + err.message);
   			}
   		);
   		mainMusic.play({ playAudioWhenScreenIsLocked : false });
   		mainMusic.setVolume(isMusicOn == '1' ? 1.0 : 0.0);
   	} else {
   		console.log('[Main Music] Media is undefined');
   	}
   }
   ```
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   
   My device is LG Q6+ (Android 7.1.1). 
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   ```
   C:\Dropbox\plinio\PRG\phonegap\myapp>npm -v
   6.4.1
   
   C:\Dropbox\plinio\PRG\phonegap\myapp>cordova -v
   9.0.0 (cordova-lib@9.0.1)
   
   C:\Dropbox\plinio\PRG\phonegap\myapp>cordova platform list
   Installed platforms:
     android 8.0.0
   Available platforms:
     browser ^6.0.0
     electron ^1.0.0
     ios ^5.0.0
     osx ^5.0.0
     windows ^7.0.0
   
   C:\Dropbox\plinio\PRG\phonegap\myapp>cordova plugin list
   cordova-custom-config 5.1.0 "cordova-custom-config"
   cordova-plugin-admobpro 2.37.2 "AdMob Plugin Pro"
   cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
   cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
   cordova-plugin-app-version 0.1.9 "AppVersion"
   cordova-plugin-cocoapod-supportx 1.7.0 "Cordova CocoaPods Dependency Support"
   cordova-plugin-device 2.0.2 "Device"
   cordova-plugin-dialogs 2.0.1 "Notification"
   cordova-plugin-extension 1.5.4 "Cordova Plugin Extension"
   cordova-plugin-file 6.0.1 "File"
   cordova-plugin-firebasex 3.0.1 "Google Firebase Plugin"
   cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
   cordova-plugin-inapppurchase-fixed 1.1.0 "In App Purchase"
   cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)"
   cordova-plugin-media 5.0.2 "Media"
   cordova-plugin-whitelist 1.3.3 "Whitelist"
   
   C:\Dropbox\plinio\PRG\phonegap\myapp>
   ```
   
   ## Checklist
   <!-- Please check the boxes by putting an `x` in the `[ ]` like so: `[x]` -->
   
   - [x] I searched for already existing GitHub issues about this
   - [x] I updated all Cordova tooling to their most recent version
   - [x] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org