SDiFI / masdif

Manager for Spoken Dialog Framework
Apache License 2.0
1 stars 0 forks source link

Widget TTS audio playback broken after recent commit #37

Open SmariF89 opened 1 year ago

SmariF89 commented 1 year ago

Commit 38eebf7f2e7b145acf6d3522384d3f8536ff4130 introduces a change which breaks TTS audio playback in the widget. It happens because the audio file URL is no longer absolute. See examples below:

URL as is returned at 38eebf7f2e7b145acf6d3522384d3f8536ff4130: /rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxrTkdNNU4yUmpOQzA1TldVNExUUmlNVEF0T0RWak5DMDFNRGN3WmpBMVpqZGlZMllHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--d9cb91a9bc45d9348c8ee7551a3bef123830b812/f2585664a39112ed939068fa4f779618bd72a50c.mp3

URL as is returned at 5531d488edff6efa23b237f3bcad07173afbbcb3: http://localhost:8080/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWsxWXpobU0yUTNaUzA0WVRWakxUUmxOV0V0T1RreE1pMWtaRGxtWTJVMVpqY3dNRGNHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--e45e4014a2c3cec26c96511bbf7619ca31c15489/075490f0cf5c440e4b673d64cf482887cf80eaaa.mp3

lumpidu commented 1 year ago

Yes, I have changed the audio asset path to a redirecting URL from a direct URL, leaving out the servername. I am using the latest chat widget of the branch STIFI-27/feat/thumbs and the voice plays just nicely ... what exactly is the problem ?

Some background:

in general, the context of the audio URL should be the same as the server URL. Therefore, there is no need to use http(s)://server-domain/.... etc. and one wants to signal to any client that the attachments are served by the server directly.

The redirecting URL is necessary, if one wants to change the assets to be served by e.g. Amazon S3 or some other external place, but still be able to control access to the audio-file itself by the Rails application (because a relative URL is used). Only if the access is granted, a redirect to the S3 URL is done, exposing the S3 asset path.

SmariF89 commented 1 year ago

Interesting. The widget was not able to use the returned path when I was doing final testing of STIFI-27/feat/thumbs before putting it into review. It worked, however, when I reverted Masdif back by one commit to 5531d48.

lumpidu commented 1 year ago

Could you change the following locally https://github.com/SDiFI/masdif/blob/38eebf7f2e7b145acf6d3522384d3f8536ff4130/app/controllers/concerns/conversation_concern.rb#L104C42-L104C57

From rails_blob_path to rails_blob_url ?

In that case the full URL should be returned.

SmariF89 commented 1 year ago

Could you change the following locally https://github.com/SDiFI/masdif/blob/38eebf7f2e7b145acf6d3522384d3f8536ff4130/app/controllers/concerns/conversation_concern.rb#L104C42-L104C57

From rails_blob_path to rails_blob_url ?

In that case the full URL should be returned.

It does indeed.

lumpidu commented 1 year ago

what is the current status here ? I cannot reproduce the issue on my side.

SmariF89 commented 1 year ago

This is on a hold for a short while. I am wrapping something else up and I will take a look at this after that.