Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11820

Cordova Media Plugin media.getDuration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.4.0
    • None
    • Ionic
    • Android 4.4 above

    Description

      I am using ionic to build a stream audio player (spotify like) and trying to build the player using cordova media plugin.

      I tried to follow the instruction in Cordova media plugin page to get duration, but it showing a different result.

      The audio file (.ogg) that I upload has 4:18, but in my android, it only has 3:17. Is there something wrong with the code?

      here is my getDuration Method

      var self = this;
      var counter = 0;
      var timerDur = $interval(function() {
      counter = counter + 100;
      if (counter > 2000)

      { $interval.cancel(timerDur); }

      var dur = self.media.getDuration();
      if (dur > 0) {
      $interval.cancel(timerDur);
      //document.getElementById('audio_duration').innerHTML = (dur) + " sec";
      self.duration = dur * 1000;
      }}, 100);

      Attachments

        Activity

          People

            Unassigned Unassigned
            vahndee fandy chandra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: