Audio

更新时间:
复制 MD 格式

This topic describes the JavaScript Application Programming Interfaces (JSAPIs) for the WVAudio class. You can use these JSAPIs to play specific system sounds when you create H5 applications or Mini Programs with Cross-Platform DevOps.

WVAudio.playSystemSound

Note

This API applies only to WindVane for iOS.

Plays a specific system sound.

Input parameters

  • [int] sound: The ID of the system sound to play. For a list of system sound IDs on iOS, see AudioServices.

  • [int] count: The number of times for continuous playback.

Callback parameters

No parameters are returned. The success callback is triggered if the sound plays successfully. Otherwise, the failure callback is triggered.

var params = {
        // The ID of the system sound to play.
        sound: 1000,
        // The number of times for continuous playback.
        count: 3
};
window.WindVane.call('WVAudio', 'playSystemSound', params, function(e) {
        alert('success');
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});