From d493cd2ecd27117e5aefcea67bb8c43cfe5262f6 Mon Sep 17 00:00:00 2001 From: spetrangeli <36695639+spetrangeli@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:55:41 -0700 Subject: [PATCH 1/2] Improved how verification time gets resetted during seek events --- samples/c2pa/plugin-dash/c2pa-dash-plugin.js | 6 +++--- src/streaming/C2pa.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/c2pa/plugin-dash/c2pa-dash-plugin.js b/samples/c2pa/plugin-dash/c2pa-dash-plugin.js index 59378dc2a5..abe9b989fd 100644 --- a/samples/c2pa/plugin-dash/c2pa-dash-plugin.js +++ b/samples/c2pa/plugin-dash/c2pa-dash-plugin.js @@ -78,9 +78,9 @@ async function c2pa_init(player, onPlaybackTimeUpdated) { currentQuality[e.mediaType] = player.getCurrentTrackFor(e.mediaType).bitrateList[e.newQuality].id; }); - player.on(dashjs.MediaPlayer.events['PLAYBACK_ENDED'], function (e) { - console.log('[C2PA] Playback ended'); - verificationTime = 0.0; + player.on(dashjs.MediaPlayer.events['PLAYBACK_SEEKING'], function (e) { + console.log('[C2PA] Streaming seeking', e); + verificationTime = e.seekTime; }); player.on(dashjs.MediaPlayer.events['PLAYBACK_TIME_UPDATED'], function (e) { diff --git a/src/streaming/C2pa.js b/src/streaming/C2pa.js index 2402bbbd90..701c9f2030 100644 --- a/src/streaming/C2pa.js +++ b/src/streaming/C2pa.js @@ -44,8 +44,8 @@ function C2paController(_eventBus, _getCurrentTrackFor) { instance ); eventBus.on( - MediaPlayerEvents.PLAYBACK_ENDED, - onPlaybackEnded, + MediaPlayerEvents.PLAYBACK_SEEKING, + onPlaybackSeeking, instance ); @@ -155,9 +155,9 @@ function C2paController(_eventBus, _getCurrentTrackFor) { ).bitrateList[e.newQuality].id; } - function onPlaybackEnded() { - console.log('[C2PA] Playback ended'); - verificationTime = 0.0; + function onPlaybackSeeking(e) { + console.log('[C2PA] Streaming seeking', e); + verificationTime = e.seekTime; } function getC2paVerificationStatus(time, streamInfo) { From 0ed8ce6d86b27a547e158e0538972a9274b91625 Mon Sep 17 00:00:00 2001 From: spetrangeli <36695639+spetrangeli@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:57:38 -0700 Subject: [PATCH 2/2] Removed event console print --- samples/c2pa/plugin-dash/c2pa-dash-plugin.js | 2 +- src/streaming/C2pa.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/c2pa/plugin-dash/c2pa-dash-plugin.js b/samples/c2pa/plugin-dash/c2pa-dash-plugin.js index abe9b989fd..90ddafd4e5 100644 --- a/samples/c2pa/plugin-dash/c2pa-dash-plugin.js +++ b/samples/c2pa/plugin-dash/c2pa-dash-plugin.js @@ -79,7 +79,7 @@ async function c2pa_init(player, onPlaybackTimeUpdated) { }); player.on(dashjs.MediaPlayer.events['PLAYBACK_SEEKING'], function (e) { - console.log('[C2PA] Streaming seeking', e); + console.log('[C2PA] Streaming seeking'); verificationTime = e.seekTime; }); diff --git a/src/streaming/C2pa.js b/src/streaming/C2pa.js index 701c9f2030..e2a1a5d1ee 100644 --- a/src/streaming/C2pa.js +++ b/src/streaming/C2pa.js @@ -156,7 +156,7 @@ function C2paController(_eventBus, _getCurrentTrackFor) { } function onPlaybackSeeking(e) { - console.log('[C2PA] Streaming seeking', e); + console.log('[C2PA] Streaming seeking'); verificationTime = e.seekTime; }