locked
How to play online music file? RRS feed

  • Question

  • How to play online music(such as mp3, ogg) in Metro Style Application with JavaScript or C++?
    Monday, January 16, 2012 9:02 AM

Answers

  • Hi Tan,

    I created a new Basic WWA and dropped your <audio> tag above into it and it played fine.  Does your application manifest have the 'Internet (Client)' capability checked in the Capabilities tab?

    Try this test: If you drop that same <audio> tag into a simple HTML page to you get an error as well?

    -Jeff


    Jeff Sanders (MSFT)
    • Marked as answer by TanJingdong Wednesday, January 18, 2012 8:14 AM
    Tuesday, January 17, 2012 2:45 PM
    Moderator

All replies

  • You will want to use the <audio> tag.  See this documentation: http://msdn.microsoft.com/en-us/library/windows/apps/hh441227.aspx

    -Jeff


    Jeff Sanders (MSFT)
    Monday, January 16, 2012 7:19 PM
    Moderator
  • Hi, jpsanders

    The audio tag can't play online music, my code in default.html is:

    <audio src="http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3" controls="controls"></audio>

    and it report the following error:

    The audio could only play local music in Metro App.

    • Edited by TanJingdong Tuesday, January 17, 2012 4:26 AM
    Tuesday, January 17, 2012 4:22 AM
  • Hi Tan,

    I created a new Basic WWA and dropped your <audio> tag above into it and it played fine.  Does your application manifest have the 'Internet (Client)' capability checked in the Capabilities tab?

    Try this test: If you drop that same <audio> tag into a simple HTML page to you get an error as well?

    -Jeff


    Jeff Sanders (MSFT)
    • Marked as answer by TanJingdong Wednesday, January 18, 2012 8:14 AM
    Tuesday, January 17, 2012 2:45 PM
    Moderator