Skip to content

Commit dcc154e

Browse files
authored
Merge pull request #38 from yama-dev/v3.1.0
V3.1.0
2 parents 3483042 + ddb8110 commit dcc154e

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The official document is here. -> https://docs.brightcove.com/brightcove-player/
1919

2020
- npm -> [https://www.npmjs.com/package/js-player-module-brightcove](https://www.npmjs.com/package/js-player-module-brightcove)
2121

22-
- Standalone(CDN) -> [https://cdn.jsdelivr.net/gh/yama-dev/js-player-module-brightcove@v3.0.1/dist/js-player-module-brightcove.js](https://cdn.jsdelivr.net/gh/yama-dev/js-player-module-brightcove@v3.0.1/dist/js-player-module-brightcove.js)
22+
- Standalone(CDN) -> [https://cdn.jsdelivr.net/gh/yama-dev/js-player-module-brightcove@v3.1.0/dist/js-player-module-brightcove.js](https://cdn.jsdelivr.net/gh/yama-dev/js-player-module-brightcove@v3.1.0/dist/js-player-module-brightcove.js)
2323

2424
- Zip -> [yama-dev/js-player-module-brightcove](https://github.com/yama-dev/js-player-module-brightcove/releases/latest)
2525

dist/js-player-module-brightcove.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
gtag('js', new Date());
2222
gtag('config', 'UA-91619969-3');
2323
</script>
24+
<style>
25+
.display_poster img {
26+
max-width: 300px !important;
27+
}
28+
</style>
2429
</head>
2530
<body>
2631
<div class="container">

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-player-module-brightcove",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"description": "Brightcove custom player using the Brightcove Player API.",
55
"keywords": [
66
"Brightcove",

src/js-player-module-brightcove.js

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* JS PLAYER MODULE BRIGHTCOVE (JavaScript Library)
33
* js-player-module-brightcove.js
4-
* Version 3.0.1
4+
* Version 3.1.0
55
* Repository https://github.com/yama-dev/js-player-module-brightcove
66
* Copyright yama-dev
77
* Licensed under the MIT license.
@@ -19,7 +19,7 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
1919
constructor(options = {}){
2020

2121
// Set Version.
22-
this.VERSION = '3.0.1';
22+
this.VERSION = '3.1.0';
2323

2424
// Set Flgs.
2525
this.PlayerChangeLoadFlg = true;
@@ -187,10 +187,6 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
187187
// Set MediaInfo
188188
this.PlayerMediaInfo = this.Player.mediainfo;
189189

190-
this.SetVolume();
191-
this.SetInfo();
192-
this.SetPoster();
193-
194190
this.EventPlay();
195191
this.EventPause();
196192
this.EventStop();
@@ -204,6 +200,13 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
204200

205201
this.AddGlobalObject();
206202

203+
videojs(this.CONFIG.player_id).on('loadedmetadata', ()=>{
204+
this.SetVolume();
205+
this.SetInfo();
206+
this.SetPoster();
207+
this.Update();
208+
});
209+
207210
// For Timeupdate.
208211
videojs(this.CONFIG.player_id).on('timeupdate', ()=>{
209212
this.Update();
@@ -750,35 +753,35 @@ export default class PLAYER_MODULE_BRIGHTCOVE {
750753
else return '0%';
751754
}
752755

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();
757761

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+
}
760769

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})` });
766772
}
767773
}
774+
}
768775

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);
772779
}
773780

774781
SetInfo(){
775782
if(this.$uiDisplayName) dom.setHtml(this.$uiDisplayName, this.PlayerMediaInfo.name);
776783
}
777784

778-
SetPoster(path){
779-
this.Player.poster(path);
780-
}
781-
782785
Destroy(){
783786
this.Player.reset();
784787
}

0 commit comments

Comments
 (0)