on 01-03-2018 4:17 AM
Hello All,
I need to play an audio in SAP UI5 , I tried using below method but it is showing error "DOMException: Failed to load because no supported source was found."
var audio =newAudio('audio_file.mp3');
audio.play();
Hello, Rewati. This issue is because of your .mp3 file could not be found. There must be something wrong with your file path. I can play mp3 by using this path on my local machine. Check your path, please. The path you are using means rootpath/audio_file.mp3.Is that correct?
var audio = new Audio("mockdata/001_A.mp3");
audio.play();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
your demand is maybe outdated, BUT:
We have a Library for that 😉
https://bestofui5.org/#/packages/srbphysicalfeedbackjs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you try to deploy any media files(audio) it will be converted to some format and wont get deployed to SAP Gateway Repository. A simple workaround for this problem was try to generate a dataURI for the audio file you need and deploy .It works with most of the browsers and even custom containers if there is any
https://dopiaza.org/tools/datauri/index.php
var audio= new Audio("data:audio/wav;base64, "you conversion data URI");
audio.oncanplaythrough = function () {
audio.play();
};
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.