DRM-X 6.0 logo bồ câu và nhánh ô liuDRM-X 6.0Tài liệu
◎ Tiếng Việt

Java, Spring Boot and Vue

Integrate protected video with Spring Security and a server-owned content catalog, then render it with Vue.

Xem MarkdownVí dụ chạy trực tiếpUpdated 2026-09-15

Quy trình cấp quyền phát video

Backend quyết định ai được xem. DRM-X cung cấp thông tin cấp quyền phát. Trình phát dùng thông tin đó để yêu cầu giấy phép DRM.

  1. Người xem

    Đăng nhập vào dịch vụ của bạn và yêu cầu xem video.

  2. Backend của bạn

    Kiểm tra giao dịch mua, gói đăng ký hoặc quyền xem khác của người dùng.

  3. DRM-X

    Áp dụng các quy tắc đã chọn và trả về cấu hình cùng thông tin cấp quyền phát.

  4. Trình phát

    Dùng thông tin cấp quyền nhận được để yêu cầu giấy phép DRM cần thiết cho việc phát video.

Hậu phương của bạn quyết định truy cập; DRM-X Áp dụng chính sách đã ký. DRM Bằng lái đi theo đường giao hàng riêng.

Build and configure the backend#

The sample uses Java 21, Spring Boot 3.5.11, Spring Security and JDBC. Build it with Maven. Set DRMX_SITE_ID, DRMX_SITE_KEY, DRMX_ACCESS_KEY and DRMX_INSTANCE_ID on the server. Bind a persistent database through DRMX_DATABASE_URL for deployment.

mvn test
mvn package
java -jar target/drmx-java-vue-1.3.0-SNAPSHOT.jar

The default H2 database is empty and held in memory. No demo account or content is authorized automatically. Connect your existing Spring Security account service, or provision users and authorities using Spring’s JdbcUserDetailsManager with encoded passwords.

Download third-party integration source

Connect your content and access rules#

Create drmx_video records with the published Content ID, content type, policy and enabled state. drmx_access binds a username to one video with start, expiry and revocation fields. VideoRepository.authorized checks these records for every request. Adapt this query to your existing course or subscription tables.

Keep the provided schema only for a new sample database. When integrating an existing production application, use your normal forward-only database migrations and disable automatic schema initialization.

Use the Vue component#

After signing in, fetch /api/drmx/videos/VIDEO_ID. Copy DrmxPlayer.vue and runtime.mjs from web-components, then pass the response contentId, contentType and sessionEndpoint to the component. It loads the pinned Shaka and Universal Player scripts automatically and replaces the old player when the selected video changes. Keep the player and authenticated session endpoint on the same origin.

The endpoint URL includes Spring Security’s CSRF token. Do not strip it when passing the URL to the component. The backend rechecks the video mapping and access before calling DRM-X. Local Java tests cover policy construction, enrollment, account isolation and revocation.