avatar image
Former Member

Audio file SAPUI5

Hello!

I am trying to play a *.wav sound in my SAPUI5 app. I have used

<audio id="my_audio" src="audio/mysong.wav"></audio> 

It works in webide but when I deploy my app to ABAP repository the song does not play.

Any help?

Regards.

Dinarte Neto

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 19, 2017 at 04:53 PM

    Hi, Dinarte.

    I would suggest verifying the audio file exists at the location the app is looking for it once it's deployed. If you check the browser's developer tools you can see the network requests being made for the app. See if the request for the .wav file is calling the path you expect and that it's succeeding.

    Also, in any case of difference in behaviour between WebIDE and ABAP system, it's good to verify that the UI5 version is the same. If you're building the app using 1.44 but your ABAP system is running 1.38 then there will be differences that may impact functionality.

    If that doesn't help, please check the browsers console log and see if you're getting any errors when running the app.

    Thanks,

    Keith Nunn
    SAP Product Support

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 19, 2017 at 04:59 PM

    Where is mysong.wav stored. If it in audio folder of the project. The can you reference it by the complete url starting from SAPUI5 service URL. /usr/sap/

    <audio id="my_audio" src="/sap/bc/ui5_ui5/sap/<SAPUI5_ServiceName>/audio/mysong.wav"></audio>

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 24 at 08:46 PM

    When you try to deploy any media files(audio) it will be converted to some format and wont get deployed to SAP Gateway Repository. As 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();
    };
    Add comment
    10|10000 characters needed characters exceeded

Skip to Content