When you implement an app that plays multi-sound which are background music and sound effects, you need to read carefully the following guidelines and sample code.
You should use only one audio element in a webOS TV app. As the audio tag uses hardware decoder and app switching is supported, sometimes media resource conflict occurs. To prevent the media resource conflict in webOS TV, only one audio element should be used in a web app. When you declare one or more audio elements in your app, sounds are not played at the same time.
- The duration of audio content must be at least 1 second.
- On app suspend, you should pause the sound and resume it when app goes foreground. Refer to the sample code.
- Multi-sound works with multiple audio elements in webOS TV Emulator which is working differently from real device.
Use Case for audio element
Playing background music in an application
Supported MIME types
Following MIME types are supported in audio element:
<audio controls autoplay> <source type="audio/mp3" src="http://media.w3.org/2010/05/sound/sound_300.mp3"/> </audio>
For your reference, see Web Audio API specifications and references below.
As only one audio element can be used in an app, you should use Web Audio API for playing sound effects.
When playing sound with Web Audio API, it has about 500 millisecond latency issue in webOS TV, so you should be aware of this before using Web Audio API in your app.
Use Case for Web Audio API
Playing sound effects in an application
Supported media formats
|webOS TV Platform Version||Supported formats|
|v1.2||Only raw files (pcm, wav)|
You cannot use SoundFont in webOS TV, which is a file format and associated technology for the computer music composition which mostly contains multiple sound inside.