A small package to apply data as well as initiate handlers for the Media Session API implemented by most browsers on both desktop and mobile to visualize content playing.
Valuable Resources
- Customize media notifications and playback controls with the Media Session API
- MDN MediaSession API Documentation
import { MediaSessionManager } from "@eyevinn/media-session-manager";
document.addEventListener("DOMContentLoaded", () => {
const videoElement = document.querySelector("video");
const metadata = {
title: "Demo Video",
siteName: "Eyevinn Demo Site",
artwork: [
{
src: "https://via.placeholder.com/512?text=Eyevinn",
sizes: "512x512",
type: "image/png",
},
],
};
new MediaSessionManager(videoElement, metadata);
});
The constructor takes three arguments
- video element
- metadata
- isLive, boolean that defaults to false (being vod)
interface MediaSessionMetadata {
title: string;
siteName: string;
pageName?: string;
artwork: Artwork[];
}
interface Artwork {
src: string;
sizes: string; // ex "512x512" as string, width x height
type: "image/jpeg" | "image/png";
}
Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in the sense that we are not commercially tied to any platform or technology vendor.
At Eyevinn, every software developer consultant has a dedicated budget reserved for open source development and contribution to the open source community. This gives us room for innovation, team building and personal competence development. And also gives us as a company a way to contribute back to the open source community.
Want to know more about Eyevinn and how it is to work here. Contact us at [email protected]!