2

i am working on my gwt prj, i have added the Vaadin audio player for mp3 file. The issue is that on Chrome, the seek bar of the audio sometimes don't work. My code is:

StreamResource resource = new StreamResource(this, filename);
Audio audio = new Audio();
audio.setSource(resource);
dialog.addComponent(audio);

The issue is 'random' and happen because of sometimes the response of the call is chunked and so there is no content-length of mp3.

Below the 2 scenarios of responses:

1:seeking bar don't working :

Request URL: https://xxx.mp3
Request Method: GET
Status Code: 200 OK
Remote Address: xxxxx
Referrer Policy: strict-origin-when-cross-origin
Cache-Control: max-age=86400
Content-Disposition: filename="xxxx.mp3       
Content-Type: audio/mpeg
Date: Thu, 15 Jul 2021 14:55:24 GMT
Expires: Fri, 16 Jul 2021 14:55:25 GMT
Pragma: cache
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Accept: */*
Accept-Encoding: identity;q=1, *;q=0
Accept-Language: en-US,en;q=0.9,es;q=0.8,it;q=0.7
Connection: keep-alive
Cookie: JSESSIONID=505AD74F160839A025EF1B71E6FC40D8; SL_G_WPT_TO=it; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1
Host: xxxx
Range: bytes=0-
Referer: xxxxxx
sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"
sec-ch-ua-mobile: ?0
Sec-Fetch-Dest: audio
Sec-Fetch-Mode: no-cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.0.0 Safari/537.36

2: seek is working

Request URL: https://xxx.mp3
Request Method: GET
Status Code: 206 Partial Content (from disk cache)
Remote Address: xxx
Referrer Policy: strict-origin-when-cross-origin
Cache-Control: max-age=86400
Content-Disposition: filename="xxx.mp3
Content-Length: 17486
Content-Range: bytes 0-17485/17486
Content-Type: audio/mpeg
Date: Thu, 15 Jul 2021 14:49:06 GMT
Expires: Fri, 16 Jul 2021 14:49:06 GMT
Pragma: cache
Server: Apache-Coyote/1.1
Accept-Encoding: identity;q=1, *;q=0                           
Range: bytes=0-
Referer: https://xxxx
sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.0.0 Safari/537.36

Is there some params in the Vaadin audio component to force to receive the content length or other solutions?

I using vaadin 7.5 and Tomcat 8 thanks

monotor
  • 107
  • 5
  • I would recommend to update your Vaadin version to 7.7.17, which is the latest public release. I am not sure it will help you, but at least it should give you all known bug fixes thus far. Regarding content length, I tend to think, it is more upto the server than Vaadin framework why it is not allways given, but why ... That I cannot say. – Tatu Lund Jul 17 '21 at 10:21
  • 1
    See [this answer](https://stackoverflow.com/a/9549404/4491066), it might be helpful. – Adam Jul 17 '21 at 15:16
  • 1
    @Adam Good point. Vaadin by default does not support http range-requests. There exists solution for Vaadin 8 but not for Vaadin 7. https://vaadin.com/directory/component/audiovideo – Tatu Lund Jul 17 '21 at 20:44

0 Answers0