Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/utils/get-analytics-player-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ const getSourceOptions = (sourceOptions = {}) => ({
abrStrategy: sourceOptions?.adaptiveStreaming?.strategy === defaults.adaptiveStreaming.strategy ? undefined : sourceOptions?.adaptiveStreaming?.strategy,
} : {}),
shoppable: hasConfig(sourceOptions.shoppable),
shoppableProductsLength: sourceOptions.shoppable && sourceOptions.shoppable.products && sourceOptions.shoppable.products.length,
shoppableProductsLength: hasConfig(sourceOptions.shoppable) && sourceOptions.shoppable.products.length,
Copy link
Contributor

@adimiz1 adimiz1 Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sourceOptions?.shoppable?.products?.length > 0

I'm wondering if this will work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a condition yes, but it will return false if length is 0, and in this specific flow, we want nulls, because false might be a valid configuration that needs to be reported to analytics (i.e. allowUsageReport: false), so if it's false we'll keep and report it, but if it's null will clean it up.

...(sourceOptions.title || sourceOptions.description || sourceOptions.info ? {
sourceInfo: hasConfig(sourceOptions.info),
sourceTitle: (typeof sourceOptions.title === 'string' ? sourceOptions.title : sourceOptions.info?.title),
sourceDescription: (typeof sourceOptions.description === 'string' ? sourceOptions.description : sourceOptions.info?.subtitle || sourceOptions.info?.description)
} : {}),
...(hasConfig(sourceOptions.textTracks) ? getTextTracksOptions(sourceOptions.textTracks) : {}),
interactionAreas: hasConfig(sourceOptions.interactionAreas),
videoSources: !!sourceOptions.videoSources,
});

Expand Down
2 changes: 1 addition & 1 deletion src/video-player.const.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Parameters that can be passed to source configuration (inherited by source method)
export const SOURCE_PARAMS = [
'adaptiveStreaming',
'allowUsageReport',
'autoShowRecommendations',
'chapters',
'cloudinaryConfig',
Expand Down Expand Up @@ -31,7 +32,6 @@ export const PLAYER_PARAMS = SOURCE_PARAMS.concat([
'_internalAnalyticsMetadata',
'ads',
'aiHighlightsGraph',
'allowUsageReport',
'analytics',
'autoplayMode',
'chaptersButton',
Expand Down
2 changes: 1 addition & 1 deletion src/video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class VideoPlayer extends Utils.mixin(Eventable) {

_sendInternalAnalytics(additionalOptions = {}) {
const options = Object.assign({}, this.playerOptions, this.options.videojsOptions, additionalOptions);
if (!options.allowUsageReport) {
if (!options.sourceOptions?.allowUsageReport) {
return;
}
try {
Expand Down