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/05/16 03:43:21 UTC

[GitHub] [cordova-plugin-media] LycheeHe opened a new issue #228: startRecord function of cordova media has two parameters(sampleRate: number, bitRate: number)!

LycheeHe opened a new issue #228: startRecord function of cordova media has two parameters(sampleRate: number, bitRate: number)!
URL: https://github.com/apache/cordova-plugin-media/issues/228
 
 
   <!------------^ Click "Preview" for a nicer view! -->
   
   I have no idea why I need to specify **two parameters to the function of startRecord** while using cordova-plugin-media. Here is the source code I used in **index.d.ts**.
   `startRecord(sampleRate: number, bitRate: number): void;`
   
   My code is below: 
   `if (!this.recordMedia) {
     this.recordMedia = new Media().create(path)
     this.recordMedia.onError.subscribe(code => this.handleMediaError(code))
     this.recordMedia.onStatusUpdate.subscribe(status => this.handleMediaStatus(status))
     this.recordMedia.onSuccess.subscribe(() => this.completeRecord())
     this.recordMedia.startRecord()
    }`
   
   I got error when I use `this.recordMedia.startRecord()`, my IDE tells my I need to add two parameters.
   
   Here is my vscode tip:
   **(method) MediaObject.startRecord(sampleRate: number, bitRate: number): void
   Starts recording an audio file.**
   
   Expected 2 arguments, but got 0.ts(2554)
   index.d.ts(77, 17): An argument for 'sampleRate' was not provided.
   
   However, startRecord() don't have any parameters, I have drawn this conclusion after I searched so many documents. For Example: 
   Quick Example [https://cordova.apache.org/docs/en/2.8.0/cordova/media/media.startRecord.html](url)
   `
   function recordAudio() {
       var src = "myrecording.mp3";
       var mediaRec = new Media(src,
           // success callback
           function() {
               console.log("recordAudio():Audio Success");
           },
           function(err) {
               console.log("recordAudio():Audio Error: "+ err.code);
           });
       mediaRec.startRecord();
   }`
   
   ---
   
   my cordova-plugin-media version: **5.0.2**
   
   ---
   
   
   Ionic:                                                                                                                                                                                                                                                                                                                                                                                                 ionic (Ionic CLI)  : 4.12.0 (C:\Users\lychee\AppData\Roaming\npm\node_modules\ionic)                                                                                                              Ionic Framework    : ionic-angular 3.9.3                                                                                                                                                          @ionic/app-scripts : 3.2.1                                                                                                                                                                                                                                                                                                                                                                       Cordova:                                                                                                                                                                                                                                                                                                                                                                                               cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)                                                                                                                                                 Cordova Platforms     : android 8.0.0                                                                                                                                                             Cordova Plugins       : not available                                                                                                                                                                                                                                                                                                                                                            System:                                                                                                                                                                                                                                                                                                                                                                                                Android SDK Tools : 26.1.1 (D:\Program Files (x86)\Android\Sdk)                                                                                                                                   NodeJS            : v10.15.1 (C:\Program Files\nodejs\node.exe)                                                                                                                                   npm               : 6.4.1                                                                                                                                                                         OS                : Windows 10
   --
   
   

----------------------------------------------------------------
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