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/09/08 17:17:01 UTC

[GitHub] [cordova-plugin-media-capture] ityoung2016 opened a new issue #143: How to initialize sampling rate in cordova-plugin-media-capture?

ityoung2016 opened a new issue #143: How to initialize sampling rate in cordova-plugin-media-capture?
URL: https://github.com/apache/cordova-plugin-media-capture/issues/143
 
 
   # Bug Report
   iPhone sampling rate starts wrong and later 'corrects itself'
   
   ## Problem
   Using the plugin I record and playback audio. On my iPad everything is fine. On the iPhone the sampling rate changes between the first recording and subsequent recordings. How can I initialize the app so that all recordings are at 44100Hz? 
   
   ### What is expected to happen?
   On my iPhone (and iPad) I expect a constant sampling rate of 44100Hz.
   
   ### What does actually happen?
   On my iPad (iOS 12.+) everything works as expected. On my iPhone (iOS 12.+) the first recording takes place at a sampling rate of **48000Hz**. *Subsequent* recordings are at the desired rate of 44100Hz.
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
    I verified this using an external tone of 1000Hz and spectral analysis on the two devices. The analysis shows a frequency of 1000Hz on the iPad but the first time on the iPhone this frequency is 918.75HZ = 1000*(44100/48000). For the record, the same cordova-generated app is run on both devices, no error messages are generated, and I do not change the sampling rate on the iPhone. It happens “by itself” through the plugin.
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
     function audioMedia(val) {
   	mediaType = 'audio';
   	var audioNum = val;
   	myAudio = null;
   	
   	// captureAudioSuccess callback
   	var captureAudioSuccess = function(mediaFiles) {
   		acquired[audioNum] = true;
   		var path = null;
   		var len = mediaFiles.length;
   		for (var i = 0; i < len; i++) {
   			path = mediaFiles[i].fullPath;
   			console.log('media full path = '+path, len);
   			readMedia(mediaFiles[0].name,audioNum);
   			}
   		};
   	// captureAudioError callback
   	var captureAudioError = function(error) {
   		alert('No audio was recorded. Try again?');
   		};
   	// start audio capture
   	navigator.device.capture.captureAudio(captureAudioSuccess, captureAudioError, audioOptions);
   	};
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   iPhone 6s, iPhone 7
   
   ### 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.
   -->
   cordova: 9.0.0 (cordova-lib@9.0.1)
   From my config.xml file: "cordova-plugin-media-capture" spec="^3.0.2" 
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to 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