DRM-X 6.0 dove 및 올리브 지점 로고DRM-X 6.0문서
◎ 한국어

Laravel and Node.js integrations

Add DRM-X to an authenticated application without exposing server credentials or trusting browser-supplied access decisions.

Markdown 보기실행 예제Updated 2026-09-15

재생이 승인되는 과정

백엔드가 시청 가능한 사용자를 결정합니다. DRM-X는 재생 승인 정보를 제공하며, 플레이어는 이를 사용해 DRM 라이선스를 요청합니다.

  1. 시청자

    서비스에 로그인하고 동영상 재생을 요청합니다.

  2. 고객 백엔드

    사용자의 구매 내역, 구독 상태 또는 기타 시청 권한을 확인합니다.

  3. DRM-X

    선택한 재생 규칙을 적용하고 재생 설정과 승인 정보를 반환합니다.

  4. 플레이어

    반환된 승인 정보를 사용해 재생에 필요한 DRM 라이선스를 요청합니다.

귀하의 백엔드가 접근을 결정합니다. DRM-X는 서명 된 정책을 시행합니다. 암호화 된 미디어 및 DRM 라이센스는 별도의 배송 경로를 따릅니다.

Install the Laravel package#

Add the laravel directory as a Composer path repository and require haihaisoft/drmx-laravel. Publish drmx-config and run the package migration. Configure DRMX_SITE_ID, DRMX_SITE_KEY, DRMX_ACCESS_KEY and DRMX_INSTANCE_ID through your host environment.

composer require haihaisoft/drmx-laravel:@dev
php artisan vendor:publish --tag=drmx-config
php artisan migrate

Create drmx_videos and drmx_access records from trusted administrator or enrollment code. The access row uses the existing Laravel user ID and includes start, expiry and revocation fields. New video records are disabled by default.

Open /drmx/videos/VIDEO_ID after signing in. The web and auth middleware remain active, including Laravel CSRF validation. The Blade page passes the current CSRF token as _token in the session endpoint URL. Four tests pass on Laravel 12.69.2; other supported dependency versions need their own acceptance run.

Download third-party integration source

Integrate with an existing Node.js backend#

Use payloadFor and createSession from node/core.mjs inside a route protected by your existing authentication and CSRF middleware. Look up the video by an internal application ID, verify the current user’s access, then pass the trusted mapping and identity to payloadFor.

Never construct the identity, policy or enabled flag from the request body. The browser may request a Content ID and DRM system, but the server must compare them with the authorized video. Map exceptions to generic client errors and return Cache-Control: no-store.

The standalone Node bridge serves LTI and hosted-platform integrations. An ordinary Express, Fastify or Next.js application should reuse the core functions behind its own login and access checks. The bridge is not an open public session proxy.

React, Next.js and Vue#

Copy DrmxPlayer.tsx for React/Next.js, or DrmxPlayer.vue for Vue, together with runtime.mjs and runtime.d.mts. Both components load the pinned player scripts automatically, show loading and error messages, and remove the previous player when the content or session endpoint changes. Unmounting the component disconnects the player. You can translate label, loadingText and errorText through your application language pack.

Pass only Content ID, content type and the authenticated same-origin session URL. These wrappers do not grant access by themselves. A hidden button, an iframe URL or a front-end route guard is not a replacement for the backend permission check.