# Marsha, a self-hosted open source video and document provider 🐠 [![CircleCI](https://circleci.com/gh/openfun/marsha/tree/master.svg?style=svg)](https://circleci.com/gh/openfun/marsha/tree/master) ## Overview `Marsha` is a video management & playback service. It is intended to be operated independently: it's like having your very own YouTube for education. Marsha also supports hosting documents and distribute them on all your courses. Instructors & organizations can use Marsha to upload and manage their videos (and associated files, such as subtitles or transcripts) or documents directly from a course as they are creating it. Once the course is published, learners simply see a video player or documents in the course. This seamless integration works with any LMS ([`Open edX`](https://open.edx.org), [`Moodle`](https://moodle.org), ...) thanks to the [LTI](https://en.wikipedia.org/wiki/Learning_Tools_Interoperability) standard for interoperability. Here is what `Marsha` offers out of the box: Video: - automatic transcoding of videos to all suitable formats from a single video file uploaded by the instructor; - adaptive-bitrate streaming playback (both HLS and DASH); - accessibility through the player itself and support for subtitles, closed captions and transcripts; Document: - upload any type of documents; - prevent disk storage quota by using AWS S3; Moreover, Marsha provides: - access control to resources through LTI authentication; - easy deployment & management of environments through `Terraform`; ## Architecture `Marsha` is made up of 3 building blocks: a **container-native** `Django` backend, an `AWS` transcoding and file storage environment, and a `React` frontend application. ### The `Django` backend The `Django` backend is tasked with serving the LTI pages that are integrated into the LMS. It also manages all the objects with their relationships, user accounts and all authentication concerns. It exposes a JSON API to communicate with the `React` frontend. It is defined using a [docker-compose file](../docker-compose.yml) for development, and can be deployed on any container environment (such as `Kubernetes`) for production. ### The storage & transcoding environment Source files (video, documents, subtitles,...) are directly uploaded to an `S3` bucket by instructors. Depending the uploaded resource, Celery tasks will be triggered to do different jobs: - Transcode videos using Peertube runners to generate all necessary video files (various formats and fragments & manifests for adaptive-bitrate streaming) into a destination `S3` bucket. Those files are then served through the `Scaleway Edge service` CDN. - Convert any kind of subtitles (also captions and transcripts) in [WebVTT](https://www.w3.org/TR/webvtt1/) format and encode them properly. - Resize thumbnails in many formats. ### The `React` frontend The `React` frontend is responsible for the interfaces with which users interact in the LTI Iframes. It gets an authenticated token with permissions from the view and interacts with the `Django` backend to manage objects and directly with `AWS s3` to upload files. It also powers the same resource view when loaded by a learner to display a video player (thanks to [videojs](https://videojs.com/)) or a document reader. ⚠️ **Iframe management** To have the best possible user experience for instructors, we need to be able to change the size of the `