@@ -18,8 +18,7 @@ import {
1818 overrideDefaultVideojsComponents
1919} from './video-player.utils' ;
2020import { FLOATING_TO , FLUID_CLASS_NAME } from './video-player.const' ;
21- import { isValidConfig } from './validators/validators-functions' ;
22- import { playerValidators , sourceValidators } from './validators/validators' ;
21+ import { isValidPlayerConfig , isValidSourceConfig } from './validators/validators-functions' ;
2322import { PLAYER_EVENT , SOURCE_TYPE } from './utils/consts' ;
2423import { getAnalyticsFromPlayerOptions } from './utils/get-analytics-player-options' ;
2524import { extendCloudinaryConfig , normalizeOptions , isRawUrl } from './plugins/cloudinary/common' ;
@@ -72,14 +71,15 @@ class VideoPlayer extends Utils.mixin(Eventable) {
7271
7372 this . videojs = videojs ( this . videoElement , this . _videojsOptions ) ;
7473
75- // to do, should be change by isValidConfig
7674 this . _isPlayerConfigValid = true ;
77-
78- isValidConfig ( this . options , playerValidators ) ;
79-
80- if ( ! this . _isPlayerConfigValid ) {
81- this . videojs . error ( 'invalid player configuration' ) ;
82- return ;
75+ if ( this . playerOptions . debug ) {
76+ isValidPlayerConfig ( this . options ) . then ( ( valid ) => {
77+ if ( ! valid ) {
78+ this . _isPlayerConfigValid = false ;
79+ this . videojs . error ( 'invalid player configuration' ) ;
80+ return ;
81+ }
82+ } ) ;
8383 }
8484
8585 if ( this . _videojsOptions . muted ) {
@@ -390,7 +390,7 @@ class VideoPlayer extends Utils.mixin(Eventable) {
390390 _initAnalytics ( ) {
391391 const analyticsOpts = this . playerOptions . analytics ;
392392
393- if ( ! window . ga && analyticsOpts ) {
393+ if ( ! window . ga && analyticsOpts && this . playerOptions . debug ) {
394394 console . error ( 'Google Analytics script is missing' ) ;
395395 return ;
396396 }
@@ -528,11 +528,12 @@ class VideoPlayer extends Utils.mixin(Eventable) {
528528 return ;
529529 }
530530
531- const isSourceConfigValid = isValidConfig ( options , sourceValidators ) ;
532-
533- if ( ! isSourceConfigValid ) {
534- this . videojs . error ( 'invalid source configuration' ) ;
535- return ;
531+ if ( this . playerOptions . debug ) {
532+ isValidSourceConfig ( options ) . then ( ( valid ) => {
533+ if ( ! valid ) {
534+ this . videojs . error ( 'invalid source configuration' ) ;
535+ }
536+ } ) ;
536537 }
537538
538539 this . _sendInternalAnalytics ( { source : options } ) ;
0 commit comments