Skip to content

Commit

Permalink
Patch 3.2.0: set duration on progress bar init
Browse files Browse the repository at this point in the history
  • Loading branch information
Dananji committed Aug 9, 2024
1 parent 96eec9f commit 6d19448
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 55 deletions.
20 changes: 3 additions & 17 deletions dist/ramp.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4724,8 +4724,8 @@ var VideoJSProgress = /*#__PURE__*/function (_vjsComponent) {
srcIndex = _this$options.srcIndex;
var _targets$srcIndex = targets[srcIndex],
start = _targets$srcIndex.start,
end = _targets$srcIndex.end;
var duration = this.player.canvasDuration;
end = _targets$srcIndex.end,
duration = _targets$srcIndex.duration;
var startTime = start,
endTime = end;
var isMultiSourced = targets.length > 1 ? true : false;
Expand Down Expand Up @@ -6480,7 +6480,6 @@ function VideoJSPlayer(_ref) {
player.src(options.sources);
player.poster(options.poster);
player.canvasIndex = cIndexRef.current;
player.canvasDuration = canvasDurationRef.current;
player.srcIndex = srcIndex;
player.targets = targets;
player.canvasIsEmpty = canvasIsEmptyRef.current;
Expand Down Expand Up @@ -6603,11 +6602,6 @@ function VideoJSPlayer(_ref) {
player.one('loadedmetadata', function () {
console.log('Player loadedmetadata');
player.duration(canvasDurationRef.current);
/**
* Set property canvasDuration in the player to use in videoJSProgress component.
* This updates the property when player.src() is updates.
*/
player.canvasDuration = canvasDurationRef.current;

// Reveal player once metadata is loaded
player.removeClass('vjs-disabled');
Expand Down Expand Up @@ -6681,15 +6675,6 @@ function VideoJSPlayer(_ref) {
player.volume(startVolume);
player.srcIndex = srcIndex;
player.duration(canvasDurationRef.current);

/**
* Set property canvasDuration in the player to use in videoJSProgress component.
* Video.js' in-built duration function doesn't seem to update as fast as
* we expect to be used in videoJSProgress component.
* Setting this in the ready callback makes sure this is updated to the
* correct value before 'loadstart' event is fired in videoJSProgress component.
*/
player.canvasDuration = canvasDurationRef.current;
if (enableTitleLink) {
player.canvasLink = canvasLinkRef.current;
}
Expand Down Expand Up @@ -7553,6 +7538,7 @@ var MediaPlayer = function MediaPlayer(_ref) {
};
}
timeFragment.altStart = timeFragment.start;
timeFragment.duration = duration;
manifestDispatch({
canvasTargets: [timeFragment],
type: 'canvasTargets'
Expand Down
2 changes: 1 addition & 1 deletion dist/ramp.cjs.min.js

Large diffs are not rendered by default.

20 changes: 3 additions & 17 deletions dist/ramp.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4692,8 +4692,8 @@ var VideoJSProgress = /*#__PURE__*/function (_vjsComponent) {
srcIndex = _this$options.srcIndex;
var _targets$srcIndex = targets[srcIndex],
start = _targets$srcIndex.start,
end = _targets$srcIndex.end;
var duration = this.player.canvasDuration;
end = _targets$srcIndex.end,
duration = _targets$srcIndex.duration;
var startTime = start,
endTime = end;
var isMultiSourced = targets.length > 1 ? true : false;
Expand Down Expand Up @@ -6448,7 +6448,6 @@ function VideoJSPlayer(_ref) {
player.src(options.sources);
player.poster(options.poster);
player.canvasIndex = cIndexRef.current;
player.canvasDuration = canvasDurationRef.current;
player.srcIndex = srcIndex;
player.targets = targets;
player.canvasIsEmpty = canvasIsEmptyRef.current;
Expand Down Expand Up @@ -6571,11 +6570,6 @@ function VideoJSPlayer(_ref) {
player.one('loadedmetadata', function () {
console.log('Player loadedmetadata');
player.duration(canvasDurationRef.current);
/**
* Set property canvasDuration in the player to use in videoJSProgress component.
* This updates the property when player.src() is updates.
*/
player.canvasDuration = canvasDurationRef.current;

// Reveal player once metadata is loaded
player.removeClass('vjs-disabled');
Expand Down Expand Up @@ -6649,15 +6643,6 @@ function VideoJSPlayer(_ref) {
player.volume(startVolume);
player.srcIndex = srcIndex;
player.duration(canvasDurationRef.current);

/**
* Set property canvasDuration in the player to use in videoJSProgress component.
* Video.js' in-built duration function doesn't seem to update as fast as
* we expect to be used in videoJSProgress component.
* Setting this in the ready callback makes sure this is updated to the
* correct value before 'loadstart' event is fired in videoJSProgress component.
*/
player.canvasDuration = canvasDurationRef.current;
if (enableTitleLink) {
player.canvasLink = canvasLinkRef.current;
}
Expand Down Expand Up @@ -7521,6 +7506,7 @@ var MediaPlayer = function MediaPlayer(_ref) {
};
}
timeFragment.altStart = timeFragment.start;
timeFragment.duration = duration;
manifestDispatch({
canvasTargets: [timeFragment],
type: 'canvasTargets'
Expand Down
20 changes: 3 additions & 17 deletions dist/ramp.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -4698,8 +4698,8 @@
srcIndex = _this$options.srcIndex;
var _targets$srcIndex = targets[srcIndex],
start = _targets$srcIndex.start,
end = _targets$srcIndex.end;
var duration = this.player.canvasDuration;
end = _targets$srcIndex.end,
duration = _targets$srcIndex.duration;
var startTime = start,
endTime = end;
var isMultiSourced = targets.length > 1 ? true : false;
Expand Down Expand Up @@ -6454,7 +6454,6 @@
player.src(options.sources);
player.poster(options.poster);
player.canvasIndex = cIndexRef.current;
player.canvasDuration = canvasDurationRef.current;
player.srcIndex = srcIndex;
player.targets = targets;
player.canvasIsEmpty = canvasIsEmptyRef.current;
Expand Down Expand Up @@ -6577,11 +6576,6 @@
player.one('loadedmetadata', function () {
console.log('Player loadedmetadata');
player.duration(canvasDurationRef.current);
/**
* Set property canvasDuration in the player to use in videoJSProgress component.
* This updates the property when player.src() is updates.
*/
player.canvasDuration = canvasDurationRef.current;

// Reveal player once metadata is loaded
player.removeClass('vjs-disabled');
Expand Down Expand Up @@ -6655,15 +6649,6 @@
player.volume(startVolume);
player.srcIndex = srcIndex;
player.duration(canvasDurationRef.current);

/**
* Set property canvasDuration in the player to use in videoJSProgress component.
* Video.js' in-built duration function doesn't seem to update as fast as
* we expect to be used in videoJSProgress component.
* Setting this in the ready callback makes sure this is updated to the
* correct value before 'loadstart' event is fired in videoJSProgress component.
*/
player.canvasDuration = canvasDurationRef.current;
if (enableTitleLink) {
player.canvasLink = canvasLinkRef.current;
}
Expand Down Expand Up @@ -7527,6 +7512,7 @@
};
}
timeFragment.altStart = timeFragment.start;
timeFragment.duration = duration;
manifestDispatch({
canvasTargets: [timeFragment],
type: 'canvasTargets'
Expand Down
2 changes: 0 additions & 2 deletions docs/build/bundle.9e7f60d7.js

This file was deleted.

2 changes: 2 additions & 0 deletions docs/build/bundle.ca7b9254.js

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="rsg-root"></div>
<script src="build/bundle.9e7f60d7.js"></script>
<script src="build/bundle.ca7b9254.js"></script>
</body>
</html>

0 comments on commit 6d19448

Please sign in to comment.