# EZDRM Implementation Guide for VOD Module

This guide covers the technical requirements and steps to implement EZDRM for your VOD content when uploading a streaming URL.

## 1. Prerequisites (What you need)

Before you start, make sure you have the following from your EZDRM account:
*   **PX Value (User ID):** This is your unique identifier provided by EZDRM.
*   **DRM-Ready Content:** Your VOD streaming URL must point to content that is already packaged/encrypted for DRM (CENC for Widevine/PlayReady, Sample-AES for FairPlay).
*   **License Server URLs:** 
    *   Widevine: `https://wv-keyos.licensekeyserver.com/`
    *   PlayReady: `https://pr-keyos.licensekeyserver.com/`
    *   FairPlay: `https://fp-keyos.licensekeyserver.com/`

## 2. Setting Up EZDRM Account

1.  Navigate to **Settings > DRM Module** in the Admin Panel.
2.  Click **Add DRM Account**.
3.  Choose **EZDRM** as the provider.
4.  Enter your **PX Value**.
5.  Save and ensure it's marked as **Active**.

## 3. Creating a DRM Profile

A profile defines the specific DRM behavior for your streams.

1.  Go to **DRM Profiles** and click **Add Profile**.
2.  Select your **EZDRM Account**.
3.  Configure the following fields:
    *   **Authorization URL:** This is usually the License Server URL mentioned above.
    *   **FPS Certificate:** (For FairPlay) Upload the `.der` or `.cer` certificate from EZDRM.
    *   **Security Levels:** Set Widevine Robustness (e.g., `SW_SECURE_CRYPTO`) and PlayReady Security Level (e.g., `150` or `200`).
4.  Save the profile.

## 4. Implementing in VOD Module

When adding or editing a VOD record:

1.  **Streaming URL:** Paste your encrypted DASH (`.mpd`) or HLS (`.m3u8`) URL.
2.  **DRM Type:** Select **EZDRM** from the dropdown.
3.  **DRM Profile:** Select the profile you created in Step 3.
4.  **Playback Token:** If your stream requires a specific session token from EZDRM, ensure it's generated and passed here (or handled via your middleware).

## 5. Technical Flow (How it works)

When a user tries to play the VOD:
1.  The App/Player fetches the VOD details via API.
2.  The API returns the `streaming_url` and the associated `drm_profile` settings.
3.  The Player uses the **Authorization URL** (License Server) to request a decryption key.
4.  EZDRM validates the request using your **PX Value** and the content metadata.
5.  If valid, the Player receives the key and starts playback.

---

**Troubleshooting Tip:**
If the video doesn't load, check the browser console (Network tab) for the license request. A `403 Forbidden` usually means the PX value or the content ID in the stream doesn't match what's on the EZDRM dashboard.
