Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular RecordingService makes incorrect assumptions about recording path #817

Open
lierdakil opened this issue Aug 13, 2023 · 0 comments
Open

Comments

@lierdakil
Copy link

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

`${this.baseUrl}recordings/${recordingId}/${recordingId}.${extension}${queryParamForAvoidCache}`

link.href = `/recordings/${recordingId}/${recordingId}.${extension}`;

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

export class ThumbnailFromUrlPipe implements PipeTransform {
transform(url: string): string {
const lastPart = url.split('/').pop();
const isMp4 = url.includes('.mp4');
if (!lastPart || !isMp4) return url;
return `recordings/${lastPart.split('.')[0]}/${lastPart.replace('mp4', 'jpg')}`;
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant