From a0f2ac7084499726c0337f32768dfaa8e124b912 Mon Sep 17 00:00:00 2001 From: Josep Boix Requesens Date: Wed, 8 Nov 2023 14:22:37 +0100 Subject: [PATCH] feat(demo): add DRM support to demo page Closes #64 Modified examples with license URLs to adhere to the expected video-js format of 'keySystems', specifying the vendor and URL as such : ```javascript { 'title': '...', 'src': ' ...', 'keySystems': { 'com.widevine.alpha': '...' } } ``` --- demo/src/ExampleDialog.js | 5 +++-- demo/src/Examples.js | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/demo/src/ExampleDialog.js b/demo/src/ExampleDialog.js index 30def55..efc7a36 100644 --- a/demo/src/ExampleDialog.js +++ b/demo/src/ExampleDialog.js @@ -16,12 +16,13 @@ dialog.querySelector('#pbw-dialog-close-btn').addEventListener('click', () => di * @param {object} options - An object containing the source and type of the video to be played. * @param {string} options.src - The source URL of the video. * @param {string} [options.type] - (Optional) The type/format of the video (e.g., 'video/mp4'). + * @param {object} [options.keySystems] - (Optional) The DRM configuration for DRM protected sources. */ -export const openModal = async ({ src, type }) => { +export const openModal = async ({ src, type, keySystems }) => { const player = Pillarbox.getPlayer('player'); if (player.currentSrc() !== src) { - player.src({ src, type }); + player.src({ src, type, keySystems }); } dialog.showModal(); diff --git a/demo/src/Examples.js b/demo/src/Examples.js index b4d33e8..0edc456 100644 --- a/demo/src/Examples.js +++ b/demo/src/Examples.js @@ -223,7 +223,9 @@ export const EXAMPLES = { { 'title': 'VoD - Dash Widewine cenc (H264)', 'src': 'https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd', - 'licenseUrl': 'https://proxy.uat.widevine.com/proxy?video_id=2015_tears&provider=widevine_test' + 'keySystems': { + 'com.widevine.alpha': 'https://proxy.uat.widevine.com/proxy?video_id=2015_tears&provider=widevine_test' + } }, { 'title': 'VoD - Dash (H265)', @@ -232,7 +234,9 @@ export const EXAMPLES = { { 'title': 'VoD - Dash widewine cenc (H265)', 'src': 'https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears.mpd', - 'licenseUrl': 'https://proxy.uat.widevine.com/proxy?video_id=2015_tears&provider=widevine_test' + 'keySystems': { + 'com.widevine.alpha': 'https://proxy.uat.widevine.com/proxy?video_id=2015_tears&provider=widevine_test' + } }, { 'title': 'VoD - Dash - MP4',