1
1
/*!
2
2
* JS PLAYER MODULE BRIGHTCOVE (JavaScript Library)
3
3
* js-player-module-brightcove.js
4
- * Version 3.0.1
4
+ * Version 3.1.0
5
5
* Repository https://github.com/yama-dev/js-player-module-brightcove
6
6
* Copyright yama-dev
7
7
* Licensed under the MIT license.
@@ -19,7 +19,7 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
19
19
constructor ( options = { } ) {
20
20
21
21
// Set Version.
22
- this . VERSION = '3.0.1 ' ;
22
+ this . VERSION = '3.1.0 ' ;
23
23
24
24
// Set Flgs.
25
25
this . PlayerChangeLoadFlg = true ;
@@ -187,10 +187,6 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
187
187
// Set MediaInfo
188
188
this . PlayerMediaInfo = this . Player . mediainfo ;
189
189
190
- this . SetVolume ( ) ;
191
- this . SetInfo ( ) ;
192
- this . SetPoster ( ) ;
193
-
194
190
this . EventPlay ( ) ;
195
191
this . EventPause ( ) ;
196
192
this . EventStop ( ) ;
@@ -204,6 +200,13 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
204
200
205
201
this . AddGlobalObject ( ) ;
206
202
203
+ videojs ( this . CONFIG . player_id ) . on ( 'loadedmetadata' , ( ) => {
204
+ this . SetVolume ( ) ;
205
+ this . SetInfo ( ) ;
206
+ this . SetPoster ( ) ;
207
+ this . Update ( ) ;
208
+ } ) ;
209
+
207
210
// For Timeupdate.
208
211
videojs ( this . CONFIG . player_id ) . on ( 'timeupdate' , ( ) => {
209
212
this . Update ( ) ;
@@ -750,35 +753,35 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
750
753
else return '0%' ;
751
754
}
752
755
753
- SetVolume ( vol ) {
754
- this . CONFIG . volume = vol ? vol : this . CONFIG . volume ;
755
- this . Player . volume ( this . CONFIG . volume ) ;
756
- }
756
+ SetPoster ( path ) {
757
+ if ( path ) {
758
+ this . Player . poster ( path ) ;
759
+ } else {
760
+ if ( this . CONFIG . poster != false ) this . CONFIG . poster = this . Player . poster ( ) ;
757
761
758
- SetPoster ( ) {
759
- if ( this . CONFIG . poster != false ) this . CONFIG . poster = this . Player . poster ( ) ;
762
+ if ( this . $uiDisplayPoster ) {
763
+ if ( this . CONFIG . mode == 'audio' ) {
764
+ dom . setHtml ( this . $uiDisplayPoster , '' ) ;
765
+ } else {
766
+ dom . setHtml ( this . $uiDisplayPoster , `<img src="${ this . CONFIG . poster } " alt="">` ) ;
767
+ }
768
+ }
760
769
761
- if ( this . $uiDisplayPoster ) {
762
- if ( this . CONFIG . mode == 'audio' ) {
763
- dom . setHtml ( this . $uiDisplayPoster , '' ) ;
764
- } else {
765
- dom . setHtml ( this . $uiDisplayPoster , `<img src="${ this . CONFIG . poster } " alt="">` ) ;
770
+ if ( this . $uiDisplayPosterBg && this . CONFIG . mode != 'audio' ) {
771
+ dom . setStyle ( this . $uiDisplayPosterBg , { backgroundImage : `url(${ this . CONFIG . poster } )` } ) ;
766
772
}
767
773
}
774
+ }
768
775
769
- if ( this . $uiDisplayPosterBg && this . CONFIG . mode != 'audio' ) {
770
- dom . setStyle ( this . $uiDisplayPosterBg , { backgroundImage : `url( ${ this . CONFIG . poster } )` } ) ;
771
- }
776
+ SetVolume ( vol ) {
777
+ this . CONFIG . volume = vol ? vol : this . CONFIG . volume ;
778
+ this . Player . volume ( this . CONFIG . volume ) ;
772
779
}
773
780
774
781
SetInfo ( ) {
775
782
if ( this . $uiDisplayName ) dom . setHtml ( this . $uiDisplayName , this . PlayerMediaInfo . name ) ;
776
783
}
777
784
778
- SetPoster ( path ) {
779
- this . Player . poster ( path ) ;
780
- }
781
-
782
785
Destroy ( ) {
783
786
this . Player . reset ( ) ;
784
787
}
0 commit comments