OpenVidu / openvidu

OpenVidu Platform main repository
https://openvidu.io
Apache License 2.0
1.86k stars 464 forks source link

Angular RecordingService makes incorrect assumptions about recording path #817

Open lierdakil opened 1 year ago

lierdakil commented 1 year ago

See subject. The assumption is the recording path is <session_id>/<session_id>.mp4, but it is, in fact, <session_id>/<REC_NAME>.mp4.

https://github.com/OpenVidu/openvidu/blob/918bf0ae6dd1c0fbf416626d82045234b0725863/openvidu-components-angular/projects/openvidu-angular/src/lib/services/recording/recording.service.ts#L80

https://github.com/OpenVidu/openvidu/blob/918bf0ae6dd1c0fbf416626d82045234b0725863/openvidu-components-angular/projects/openvidu-angular/src/lib/services/recording/recording.service.ts#L94

This affects both play and download actions. A better approach may be to just use url verbatim, chopping off everything up to and including /openvidu/, and plopping the rest as the video URL, i.e. if url as reported in RecordingInfo is https://foo.com/openvidu/recordings/... you could just string.replace(/^.*?/openvidu/$/, '/').

Furthermore, it makes equally incorrect, but in some sense the inverse assumption about thumbnail names: apparently, it assumes thumbnail names are <rec_name>/<rec_name>.jpg (by taking the last component of the video url), but they are, in fact, <session_id>/<session_id>.jpg. A better approach is to perhaps construct the thumbnail url the way the video url is currently constructed, i.e. as ${baseUrl}recordings/${recording.id}/${recording.id}.jpg

https://github.com/OpenVidu/openvidu/blob/918bf0ae6dd1c0fbf416626d82045234b0725863/openvidu-components-angular/projects/openvidu-angular/src/lib/pipes/recording.pipe.ts#L62-L71