Status: Completed
The video image/poster/thumbnail feature will allow users to see static image on video component before they click play just like youtube. To show the poster on video component (as first frame) we'll provide a way to upload image for particular video via "Video Uploads" page. Since our design for this feature adds a significant infrastructure requirement, we're giving it a dedicated design document.
HTTP clients use this end point to upload video images, as well as to update existing ones.
Course authors & admin will be able to add / edit the image for videos.
Also these images will be world readable via S3 link.
Method | Description | Access |
---|---|---|
POST | Upload a new video image. If one already exists, it will be replaced by this one. | course staff, admin |
NOTE: Validation will be added to backend as well as client side.
Video image field will adopt approach just like block structure's data field https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/content/block_structure/models.py#L166
For devstack we'll be using default Django storage and for production/stage like environment we'll be using s3
VIDEO_IMAGE_SETTINGS = dict( STORAGE_CLASS='storages.backends.s3boto.S3BotoStorage', STORAGE_KWARGS=dict(bucket='video-images-test-bucket'), DIRECTORY_PREFIX='video_images/', ) |
The video images will be stored using Django Storages to abstract away the details of where the images are stored. Here's how it works:
client_max_body_size
directive which limits upload size. The value passed to that directive is also given to the CMS as a second line of defense.In production, CDN domains will be used in image URLs. The CDN will be configured to cache on unique image URLS, so that whenever a user uploads a new image, the CMS/LMS starts serving image URLs with the new image URL, causing the CDN to cache a new image.
expires
nginx directive. When serving images from a CDN/S3, caching is configured by including Cache-Control: max-age
in the headers
. The value is in seconds in both cases.prod
, stage
, and load-test
prefixes. One CDN serves the entire bucket. In edge, all images are at the top level of the bucket. Edge has its own CDN. In the sandbox environment, each sandbox's IAM role allows it to upload to the appropriate bucket only by prefixing all files with the sandbox's IP address.To clean the old/stale images from s3 bucket, the real scenario could be if someone uploads an image and update it later, given that we're using timestamp as image name, the old image would be there forever. Here are different approaches that we can take to address this issue: