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 2020/03/08 12:40:19 UTC

[GitHub] [cordova-plugin-media] Saammode opened a new issue #270: Cannot read property 'pause' of null

Saammode opened a new issue #270: Cannot read property 'pause' of null
URL: https://github.com/apache/cordova-plugin-media/issues/270
 
 
   <!--
   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
    When i try to pause and stop a audio i am getting an error saying "Cannot read property 'pause' of null". I can perfectly play the audio.
   ## Information
   I am using phonegap and i am including the script at end of page before body.
   
   ### Command or Code
     var my_media = null;
     var mediaTimer = null;
     
     function playAudio(src) {
       var url = src;
       var my_media = new Media(url,
               // success callback
                function () { 
                  console.log("playAudio():Audio Success");
                  media.release();
                   },
               // error callback
                function (err) { console.log("playAudio():Audio Error: " + err);
                               alert("Download the audio first!")
                               }
       );
              // Play audio
       my_media.play();
   }
     
     // Pause audio
     // 
     function pauseAudio() {
       my_media.pause();
             
         
     }
     
     // Stop audio
     // 
     function stopAudio() {
       my_media.stop();
         clearInterval(mediaTimer);
         mediaTimer = null;
     }
     
     // onSuccess Callback
     //
     function onSuccess() {
         console.log("playAudio():Audio Success");
     }
     
     // onError Callback 
     //
     function onError(error) {
       console.log('code: '    + error.code    + '\n' + 
               'message: ' + error.message + '\n');
     }
     
   
   ### Environment, Platform, Device
   In phonegap, Android, Any device
   
   
   
   ### 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.
   -->
   
   
   
   ## 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