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

WP7 : Cannot play MP3/wav using MEDIA

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.8.0, 2.0.0
    • None
    • cordova-wp7 (DEFUNCT)
    • None
    • Nokia Lumia 800 with WP 7.5 (7.10.8773.98). Cordova 2.0.0

    Description

      UPDATED with 2.0 and lastest WP7 OS version information (2012-08-09)

      2.0

      index.html

      [...]
              <title>Hello Cordova</title>
      <script>
        function MyInit()
        {
        document.getElementById("welcomeMsg").innerHTML += "Cordova is ready! version=" + window.device.cordova;
        console.log("onDeviceReady. You should see this message in Visual Studio's output window.");
        //  my_media = new Media("app/www/test.mp3");//ressource buildAction == content
        my_media = new Media("app/www/chord.wav");//ressource buildAction == content; copied from C:\Windows\Media
      
        my_media2 = new Media("app/www/test2.mp3");//ressource buildAction == content
        }
      
        var playCounter = 0;
        var my_media = null;
        function playMP3(){
        console.log("playMP3() counter " + playCounter);
        my_media.play();
        playCounter++;
        }
      
        var my_media2 = null;
        function playMP32(){
        console.log("playMP32() counter " + playCounter);
        my_media2.play();
        playCounter++;
        }
      
      </script>
      
          </head>
          <body>
              <div id="welcomeMsg"></div>
              <div class="app">
                  <h1>Apache Cordova</h1>
                  <div id="deviceready">
                      <p class="status pending blink">Connecting to Device</p>
                      <p class="status complete blink hide">Device is Ready</p>
                  </div>
              </div>
              <script type="text/javascript" src="cordova-2.0.0.js"></script>
              <script type="text/javascript" src="js/index.js"></script>
              <script type="text/javascript">
                  app.initialize();
      			</script>
      
          <p onclick="playMP3();">Click to Play MP3</p>
          <p onclick="playMP32();">Click to Play MP3 2</p>
      
      
      			</body>
      </html>
      [EOF]
      

      index.js

      [...]
          deviceready: function() {
              // note that this is an event handler so the scope is that of the event
              // so we need to call app.report(), and not this.report()
              app.report('deviceready');
      		MyInit();
          },
      [...]
      

      output (debug config, terminal connected to Zune):

      'UI Task' (Managed): Loaded 'System.SR.dll'
      A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
      A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll
      Updating IsolatedStorage for APP:DeviceID :: [edited]
      INFO: Creating Directory :: /app/www
      INFO: Writing data for /app/www\chord.wav and length = 113964
      INFO: Creating Directory :: /app/www\js
      INFO: Writing data for /app/www\js\index.js and length = 792
      INFO: Writing data for /app/www\test.mp3 and length = 34396
      INFO: Writing data for /app/www\test2.mp3 and length = 34396
      INFO: Writing data for /app/www\cordova-2.0.0.js and length = 188657
      INFO: Creating Directory :: /app/www\css
      INFO: Writing data for /app/www\css\index.css and length = 2239
      INFO: Creating Directory :: /app/www\img
      INFO: Writing data for /app/www\img\cordova.png and length = 19932
      INFO: Writing data for /app/www\index.html and length = 1990
      GapBrowser_Navigated :: /app/www/index.html
      'UI Task' (Managed): Loaded 'System.ServiceModel.Web.dll'
      'UI Task' (Managed): Loaded 'System.ServiceModel.dll'
      The thread '<No Name>' (0x16490a2e) has exited with code 0 (0x0).
      The thread '<No Name>' (0x17630a6a) has exited with code 0 (0x0).
      Log:"report:deviceready"
      The thread '<No Name>' (0x16a507aa) has exited with code 0 (0x0).
      'UI Task' (Managed): Loaded 'Microsoft.Xna.Framework.dll'
      Log:"onDeviceReady. You should see this message in Visual Studio's output window."
      The thread '<No Name>' (0x173d0dbe) has exited with code 0 (0x0).
      The thread '<No Name>' (0x1731027e) has exited with code 0 (0x0).
      The thread '<No Name>' (0x162a0a4e) has exited with code 0 (0x0).
      Log:"playMP3() counter 0"
      A first chance exception of type 'System.ArgumentNullException' occurred in mscorlib.dll
      The thread '<No Name>' (0x16cd082e) has exited with code 0 (0x0).
      The thread '<No Name>' (0x176d0d3a) has exited with code 0 (0x0).
      Log:"playMP32() counter 1"
      The thread '<No Name>' (0x16a808e6) has exited with code 0 (0x0).
      A first chance exception of type 'System.ArgumentNullException' occurred in mscorlib.dll
      The thread '<No Name>' (0x179e0852) has exited with code 0 (0x0).
      

      My Config:

      • cordova : 2.0.0
      • Nokia Lumia 800
      • Version OS : 7.10.8773.98 (commercial : 7.5)
      • Microsoft Visual Studio 2010
        Version WPDTRTMRel - 40219.209
        Microsoft .NET Framework
        Version 4.0.30319 SP1Rel
        Installed Version: PD Express

      1.8 / (7.10.7740.16)

      The MP3 file is only played once (the first time).

      • If I create a new instance of MEDIA each time, the MP3 file is only played once (the first time).
      • If I keep alive the instance (create it in onDeviceReady), I can play multiple time the first mp3 I play. BUT, I cannot play the other mp3.

      note:

      • with version 1.6.1, turn OFF then ON the screen allow you to play one more time the mp3. Not with 1.8.0.
      • same issue with 1.6.1, but the error message are IOException & IsolatedStorageException with various "MEDIA on status" information.
            var playCounter = 0;
            var my_media = null;
            function playMP3(){
              console.log("playMP3()counter " + playCounter);
              if (!(my_media == null)){
                my_media.release(); //Cordova 1.8.0
              }
              my_media = new Media("app/www/test.mp3");//ressource buildAction == content
      
              my_media.play();
              playCounter++;
            }
      
            var my_media2 = null;
              function playMP32(){
              console.log("playMP32() counter " + playCounter);
              if (!(my_media2 == null)){
                my_media2.release(); //Cordova 1.8.0
              }
              my_media2 = new Media("app/www/test2.mp3");//ressource buildAction == content
            my_media2.play();
            playCounter++;
            }
      
          [...]
          <p onclick="playMP3();">Click to Play MP3</p>
          <p onclick="playMP32();">Click to Play MP3 2</p>
      

      Log:

      Log:"onDeviceReady. You should see this message in Visual Studio's output window."
      'UI Task' (Managed): Loaded 'Microsoft.Xna.Framework.dll'
      Log:"playMP3() counter 0"
      'UI Task' (Managed): Loaded 'System.SR.dll'
      A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
      Log:"playMP3() counter 1"
      A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
      Dispose :: app/www/test.mp3
      A first chance exception of type 'System.NullReferenceException' occurred in WP7CordovaClassLib.dll
      A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
      Error: El parĂ¡metro es incorrecto. 
      Log:"playMP32() counter 2"
      INFO: startPlayingAudio could not find mediaPlayer for b5e8e480-de8b-ab2c-82a6-c60270f590f2
      A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
      Error: El parĂ¡metro es incorrecto. 
      

      Attachments

        1. chord.wav
          111 kB
          Christophe A. Guilmart
        2. index.html
          2 kB
          Christophe A. Guilmart
        3. index.js
          0.8 kB
          Christophe A. Guilmart
        4. test.mp3
          34 kB
          Christophe A. Guilmart

        Activity

          People

            purplecabbage Jesse MacFadyen
            christophe.guilmart Christophe A. Guilmart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: