WoW:API PlayMusic: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
<center>'''PlayMusic''' ''-Documentation by [[user:Holo|Holo]]-''</center>
{{wowapi}} __NOTOC__
Plays the given mp3 file.
PlayMusic(soundFile);


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
==Parameters==
 
===Arguments===
PlayMusic("mp3");
:;soundFile : String - path to a MP3 file. You can refer to both files in WoW's MPQs, or your own music files in your addon's directory.
 
<!-- Describe the purpose of the function, though exhausting detail can be saved for a later section -->
 
Plays the given mp3.
 
----
;''Arguments''
 
<!-- List each argument, together with its type -->
 
:("mp3")
:;mp3 : String - This is the complete path to an mp3. It is relative to your World of Warcraft\Data sub-folder!
 
----
;''Example''
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->


==Example==
  PlayMusic("Sound\\Music\\GlueScreenMusic\\wow_main_theme.mp3");
  PlayMusic("Sound\\Music\\GlueScreenMusic\\wow_main_theme.mp3");
PlayMusic("Interface\\AddOns\\Foo\\bar.mp3");
===Result===
Current music fades out, login or custom music plays.


PlayMusic("website.com");
==Notes==
 
*You cannot pause the playback, but you can stop it with [[API_StopMusic|StopMusic()]].
----
*You cannot use this function to play custom MP3 files located outside an addon's directory. You cannot use this function to play custom MP3 files that were added to an addon's directory after WoW has been launched.
;''Details''
*If any of the built-in music is playing when you call this function (e.g. Stormwind background music), it will fade out.
 
*(Not verified): since World of Warcraft uses the FMOD sound engine, it is very likely that other file formats than mp3 are supported. For example OggVorbis (.ogg).
<!-- Details not appropriate for the main description can go here -->
 
: This function plays the given music file (file format has to be mp3, I think. I have not tried others.) You cannot pause the playback. You can stop it with [[API StopMusic|StopMusic]].
: If any of the built-in music is playing when you call this function (e.g. Stormwind background music), it will fade out.
: The file you specified will loop until you call [[API StopMusic|StopMusic]].
: This Function can be used with website url's such as those used by Internet Radio Stations.
 
: (Not verified): since World of Warcraft uses the FMOD sound engine, it is very likely that other file formats than mp3 are supported. For example OggVorbis (.ogg).
----
{{Template:WoW API}}

Revision as of 15:32, 22 April 2007

WoW API < PlayMusic

Plays the given mp3 file.

PlayMusic(soundFile);

Parameters

Arguments

soundFile
String - path to a MP3 file. You can refer to both files in WoW's MPQs, or your own music files in your addon's directory.

Example

PlayMusic("Sound\\Music\\GlueScreenMusic\\wow_main_theme.mp3");
PlayMusic("Interface\\AddOns\\Foo\\bar.mp3");

Result

Current music fades out, login or custom music plays.

Notes

  • You cannot pause the playback, but you can stop it with StopMusic().
  • You cannot use this function to play custom MP3 files located outside an addon's directory. You cannot use this function to play custom MP3 files that were added to an addon's directory after WoW has been launched.
  • If any of the built-in music is playing when you call this function (e.g. Stormwind background music), it will fade out.
  • (Not verified): since World of Warcraft uses the FMOD sound engine, it is very likely that other file formats than mp3 are supported. For example OggVorbis (.ogg).