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

Teacher session #162

Open
wants to merge 44 commits into
base: live
Choose a base branch
from
Open

Teacher session #162

wants to merge 44 commits into from

Conversation

snowman562
Copy link
Contributor

Please review and let me know

@github-actions
Copy link

github-actions bot commented Oct 17, 2020

Visit the preview URL for this PR (updated for commit e54e371):

https://joie-app--pr162-teacher-session-crl1q2ip.web.app

(expires Sat, 14 Nov 2020 10:28:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Copy link
Collaborator

@yinonov yinonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • hook to the Kaltura final confirmation of success on the backend after its progress, so that we trigger the session document video reference property update on firebase.
  • upload component on session page should only be visible to an owner of a session
  • make sure upload is secure, so that only an owner can upload a video
  • garbage collect replaced videos on new upload (delete previous video from the Kaltura storage)
  • progress bar indication of upload state
  • add the ability to replace a current video by a new one
  • upload area should be wrapped by mat-card
  • as the Kaltura video processing take quite a while we may should a pending indicator to let users be aware
  • once the video upload has finished I couldn't see the new video replacing the uploader. only when I refreshed the page. firestore should be easily reactive with data and we can hook to the document observable to reactively show the new video
  • trying to upload specific video of mine result in a blank rectangle. the video is a webm file
    image

@snowman562
Copy link
Contributor Author

snowman562 commented Oct 18, 2020

  • hook to the Kaltura final confirmation of success on the backend after its progress, so that we trigger the session document video reference property update on firebase.
  • upload component on session page should only be visible to an owner of a session
  • make sure upload is secure, so that only an owner can upload a video
  • garbage collect replaced videos on new upload (delete previous video from the Kaltura storage)
  • We update the session document video reference property when we get Kaltura final confirmation of success.
  • Upload component is only visible for an owner. And it's secure.
  • We are replacing the videos by entryId now, so we don't worry about garbage collect.

@snowman562 snowman562 closed this Oct 18, 2020
@snowman562 snowman562 reopened this Oct 18, 2020
@yinonov
Copy link
Collaborator

yinonov commented Oct 18, 2020

  • hook to the Kaltura final confirmation of success on the backend after its progress, so that we trigger the session document video reference property update on firebase.
  • upload component on session page should only be visible to an owner of a session
  • make sure upload is secure, so that only an owner can upload a video
  • garbage collect replaced videos on new upload (delete previous video from the Kaltura storage)
  • We update the session document video reference property when we get Kaltura final confirmation of success.
  • Upload component is only visible for an owner. And it's secure.
  • We are replacing the videos by entryId now, so we don't worry about garbage collect.

still able to upload to a session I don't own
image

@snowman562
Copy link
Contributor Author

  • hook to the Kaltura final confirmation of success on the backend after its progress, so that we trigger the session document video reference property update on firebase.
  • upload component on session page should only be visible to an owner of a session
  • make sure upload is secure, so that only an owner can upload a video
  • garbage collect replaced videos on new upload (delete previous video from the Kaltura storage)
  • We update the session document video reference property when we get Kaltura final confirmation of success.
  • Upload component is only visible for an owner. And it's secure.
  • We are replacing the videos by entryId now, so we don't worry about garbage collect.

still able to upload to a session I don't own
image

Which session?

@yinonov
Copy link
Collaborator

yinonov commented Oct 18, 2020

@snowman562 4CJrFfb53KVLOuivduYV

@snowman562
Copy link
Contributor Author

snowman562 commented Oct 19, 2020

  • add the ability to replace a current video by a new one
    We already have this feature.
  • upload area should be wrapped by mat-card
    It's done
  • as the Kaltura video processing take quite a while we may should a pending indicator to let users be aware
    Added manual pending time while video processing on Kaltura.
  • once the video upload has finished I couldn't see the new video replacing the uploader. only when I refreshed the page. firestore should be easily reactive with data and we can hook to the document observable to reactively show the new video
    It's weird. It works fine on my end. Please recheck on latest version.
  • trying to upload specific video of mine result in a blank rectangle. the video is a webm file
    I uploaded my webm file successfully. Please recheck it.

And it's very strange why you can upload on the session that's not owned by you. It shouldn't be. Please recheck latest commits and show me full screenshot(with session id and login detail)

@yinonov
Copy link
Collaborator

yinonov commented Oct 19, 2020

now all sessions have the same video, which is odd

  • each session should have its own video

  • we should have the ability to replace the video with a fab button or something

@LolaRev
Copy link
Collaborator

LolaRev commented Oct 20, 2020

Comments:

Hi, I have a couple of questions about it.
The figma file has 2 parts:
upload an on-demand video.
upload a thumbnail photo or an intro video.
The way it is created it looks like there is only one option available which is uploading the video.
My comments:
The video uploaded on the top part is the on-demand video and it should be as long as needed. The comment is not for this video. I would also like to add a progression bar and not a loader as it is a better indication for the user to know how long it will take.
The part at the bottom is missing completely. This is where they should be able to upload an image or an introduction video (up to a minute) or a photo.
The UI doesn't look as in the Figma and needs to be fixed.

Upload a video failed:
image

Once the video and the photo is uploaded the UI should no longer be there, only on editing mode.

@snowman562
Copy link
Contributor Author

Comments:

Hi, I have a couple of questions about it.
The figma file has 2 parts:
upload an on-demand video.
upload a thumbnail photo or an intro video.
The way it is created it looks like there is only one option available which is uploading the video.
My comments:
The video uploaded on the top part is the on-demand video and it should be as long as needed. The comment is not for this video. I would also like to add a progression bar and not a loader as it is a better indication for the user to know how long it will take.
The part at the bottom is missing completely. This is where they should be able to upload an image or an introduction video (up to a minute) or a photo.
The UI doesn't look as in the Figma and needs to be fixed.

Upload a video failed:
image

Once the video and the photo is uploaded the UI should no longer be there, only on editing mode.

UI was built based on your design, but it's updated after discussing with @yinonov . Please confirm it with him.
Regarding the progress bar, it's still pending task because Kaltura API doesn't give us the estimated uploading time.

uiconf_id: 46213871,
flashvars: {},
cache_st: 1602684332,
entry_id: '1_v3d6yfj9',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this value coming from?

Copy link
Collaborator

@ilirhushi ilirhushi Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinonov as I am seeing I guess the entry_id it should come from session object and the others from kalturaConfiguration

entryId: this.entryId,
entryLastUpdated: new Date().getTime(),
})
.subscribe(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subscriptions must be unsubscribed at some point. add the untilDestroy decorator and pipe as we do in other subscriptions

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinonov adjusted this, using the untilDestroy

entryLastUpdated: new Date().getTime(),
})
.subscribe(() => {
window.location.reload();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can cause issues if user is in editing process or reading. can be really bad ui-wise.
I'd suggest the following practice:
entryLastUpdated should also be an input and a member of the app-video-player component. then we would be able to hook to SimpleChanges conditionally to observe entryLastUpdated and trigger the video embedding on ngOnChanges instead of ngOnInit in KalturaVodPlayerComponent

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinonov this pice of code doesn't exists anymore

.subscribe(() => {
window.location.reload();
});
}, 60000);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the best we can do? no hook to actual completion indication by Kaltura's observable?

@yinonov
Copy link
Collaborator

yinonov commented Oct 22, 2020

Reply from Kaltura on issues we face -

1 – there isn’t a notification on progress, however you can register for an http notification when the media entry’s status changes and/or is ready. Please see the workflow detailed here for more info: https://developer.kaltura.com/workflows/Integration_Scheduling_and_Hooks/Backend_and_Email_Notifications

2 – Yes, please read about authentication and security via the Kaltura Session here: https://developer.kaltura.com/api-docs/VPaaS-API-Getting-Started/Kaltura_API_Authentication_and_Security.html
Also, if you provide more info on the workflow and scenario that you are concerned about, that will help

This was also asked in Yinon’s email:
We have cases where we replace videos and want the old videos to be garbage collected from storage to prevent bloat or unnecessary storing. Currently we are replacing the videos by entryId is that enough for videos to be collected (if they have no other reference)? or should we explicitly delete them?

In general, it’s not good practice to replace videos of the same entry. Why not delete the entry and create a new one?

points taken:

  • we can register for an http notification when the media entry’s status changes and/or is ready
  • we should dig on security docs to prevent random user with no access claims uploading to storage
  • Upon successful upload we should delete the previous entry explicitly and replace its id reference in our firebase session doc with the new id

this.sessionsFacade
.setSession(this.sessionId, {
entryId: this.entryId,
entryLastUpdated: new Date().getTime(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. firebase stores its own timestamp in documents when it's provided with a js Date value. so better to remove the getTime method
  2. such practices should be done on cloud function event triggers. hook to session doc update and set the new Date()
  3. what is the use of the entryLastUpdated anyway?

@ilirhushi
Copy link
Collaborator

Hi @LolaRev,

I have this situation of a session which has video but alongside it is also visible the upload form as shown in the following image:

Screenshot 2020-11-03 at 8 45 01 PM

what do you suggest for this case in UI perspective?

Thanks.

@LolaRev
Copy link
Collaborator

LolaRev commented Nov 4, 2020

@ilirhushi @yinonov that was an issue that wasn't clear to me (I comment on it on the other task).

There are 2 components for uploading a video:

  1. The teacher needs to upload the video (for on-demand) or create a link for it (for live streaming).
  2. The teacher needs to upload a thumbnail photo/intro video (30 sec) to both types of video. These will appear on the card and on the session page on top, and will be viewed by every user.

The way it was built is that you have 2 different videos and it is not how it should be. (this is why you have another screen at the bottom).

Since we decided not to have the intro video to begin with and only a thumbnail photo, we need to have the option to add it while uploading the video. It should be a separate image for a thumbnail.

I hope it is clear now. Let me know if you have any questions.

Copy link
Collaborator

@yinonov yinonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review still in progress
I'm aware of the fact most of the is inherited

@@ -51,6 +52,7 @@ import { NgxAuthFirebaseUIModule } from 'ngx-auth-firebaseui';
// provide: ORIGIN,
// useValue: environment.production ? undefined : 'http://localhost:5001',
// },
KalturaClient
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required everywhere on the app?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep the KalturaClient is used at KalturaApiHandShakeService

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we create a kaltura module of our own to be imported where needed? that way we could also remove the script fetch in

<script
src="https://cdnapisec.kaltura.com/p/2976751/sp/297675100/embedIframeJs/uiconf_id/46180971/partner_id/2976751"
defer
></script>
to that module (same as youtube component)

<app-video-player [entryId]="entryId" [entryLastUpdated]="entryLastUpdated"></app-video-player>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need this entryLastUpdated. Will break anything if we remove it from the app totally?

This whole component actually seems like just a proxy to the VOD player component. Consider removing it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinonov If we remove it I guess it will not break anything, is just a timestamp on when the entry was updated on Kaltura side

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as @pfuternik suggested, entry shouldn't be updated but deleted, and create a new entry. so this should probably be removed

Comment on lines +19 to +36
<mat-tab label="Image">
<h3 class="joie-list-name">Upload a thumbnail image</h3>
<mat-spinner style="margin: auto" *ngIf="uploading"></mat-spinner>
<ngx-file-drop dropZoneLabel="Drop files here" (onFileDrop)="dropped($event)" accept="image/*" *ngIf="!uploading">
<ng-template ngx-file-drop-content-tmp let-openFileSelector="openFileSelector">
<div class="mt-3">Drop your file here or</div>
<button mat-flat-button color="primary" (click)="uploadImgControl.click()" type="button"
class="uploadBtn" [disabled]="uploading">
<span *ngIf="!uploading">Browse</span>
</button>
</ng-template>
</ngx-file-drop>
<h5 class="border-bottom">
Size: 1280x720 px. Formats: JPG, GIF, or PNG.
</h5>
</mat-tab>
</mat-tab-group>
<input hidden="true" type="file" accept="image/*" #uploadImgControl (change)="onClickFile($event)" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The should be an own dedicated component for image handling. We also use image thumbnail picker in session form so we should unite.
The should be split to 3 parts

  • File picker & dropzone
  • Video upload handler (service?)
  • Image upload handler (service?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yinonov so basically I tried to refactor and have them in service: KalturaApiHandShakeService, having Video & Image upload handler in one service

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u mean ur on that? working out?

);
}

fileReplace() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfuternik suggested to delete an entry of video and replace by a new video and entry. This seems like a backend concern as when a new video ref is about to override a previous one, then we should delete that previous entry video before setting the new ref.

}
}

public dropped(files: NgxFileDropEntry[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be extracted to a dedicated component

apps/joie/src/app/sessions/models/session-variants.ts Outdated Show resolved Hide resolved
apps/joie/src/assets/icons/icons-set/border-or.svg Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

4 participants