I am thinking about developing a paid JS script, and I wanted to prevent its piracy by using HTML5's EME to safely decrypt and use my JavaScript file client-side.

Can EME be used for more than just audio/video content?



You cannot currently use Encrypted Media Extensions (EME) to prevent JavaScript piracy.

Because JavaScript is interpreted client-side by the user's browser, the source code can be retrieved.

What are Encrypted Media Extensions (EME)?

According to Google:

Encrypted Media Extensions provides an API that enables web applications to interact with content protection systems, to allow playback of encrypted audio and video.

The W3C Recommendation for Encrypted Media Extensions explains:

This proposal extends HTMLMediaElement providing APIs to control playback of encrypted content.

What is a HTMLMediaElement?

Mozilla describes the HTMLMediaElement as:

The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. The HTMLVideoElement and HTMLAudioElement elements both inherit this interface.

In other words, HTMLMediaElement simply refers to <video> and <audio> content.

From this information, we can conclude that Encrypted Media Extensions act as a gateway between a client's web browser and DRM software: specifically audio and video. [Source]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.