Skip to content

Commit a9348fa

Browse files
committed
Make imscJS style options generic
1 parent bb0646d commit a9348fa

File tree

2 files changed

+148
-11
lines changed

2 files changed

+148
-11
lines changed

src/core/Settings.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,8 @@ import Events from './events/Events';
513513
* When true, only those captions where itts:forcedDisplay="true" will be displayed.
514514
* @property {boolean} [imsc.enableRollUp=true]
515515
* Enable/disable rollUp style display of IMSC captions.
516-
* @property {number} [imsc.options.sizeAdjust=1]
517-
* IMSC styling options - adjust text size, scales the text size and line padding
518-
* @property {number} [imsc.options.lineHeightAdjust=1]
519-
* IMSC styling options - scales the line height
520-
* @property {number} [imsc.options.backgroundOpacityScale=1]
521-
* IMSC styling options - scales the backgroundColor opacity
516+
* @property {number} [imsc.options]
517+
* IMSC styling options - including; sizeAdjust, lineHeightAdjust, backgroundOpacityScale and fontFamily. See the renderHtml function of imscJS for full details
522518
* @property {object} [webvtt.customRenderingEnabled=false]
523519
* Enables the custom rendering for WebVTT captions. For details refer to the "Subtitles and Captions" sample section of dash.js.
524520
* Custom WebVTT rendering requires the external library vtt.js that can be found in the contrib folder.
@@ -1015,11 +1011,7 @@ function Settings() {
10151011
imsc: {
10161012
displayForcedOnlyMode: false,
10171013
enableRollUp: true,
1018-
options: {
1019-
sizeAdjust: 1,
1020-
lineHeightAdjust: 1,
1021-
backgroundOpacityScale: 1
1022-
},
1014+
options: null,
10231015
},
10241016
webvtt: {
10251017
customRenderingEnabled: false
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
import CatchupController from '../../src/streaming/controllers/CatchupController';
2+
import Settings from '../../src/core/Settings';
3+
4+
import VideoModelMock from './mocks/VideoModelMock';
5+
import DashMetricsMock from './mocks/DashMetricsMock';
6+
import StreamControllerMock from './mocks/StreamControllerMock';
7+
import StreamMock from './mocks/StreamMock';
8+
import MediaPlayerModelMock from './mocks/MediaPlayerModelMock';
9+
import PlaybackControllerMock from './mocks/PlaybackControllerMock';
10+
11+
const expect = require('chai').expect;
12+
const context = {};
13+
14+
describe('CatchupController', function () {
15+
16+
let catchupController,
17+
streamMock,
18+
videoModelMock,
19+
dashMetricsMock,
20+
streamControllerMock,
21+
playbackControllerMock,
22+
mediaPlayerModelMock,
23+
settings;
24+
25+
beforeEach(function () {
26+
settings = Settings(context).getInstance();
27+
videoModelMock = new VideoModelMock();
28+
dashMetricsMock = new DashMetricsMock();
29+
streamMock = new StreamMock();
30+
streamControllerMock = new StreamControllerMock();
31+
playbackControllerMock = new PlaybackControllerMock();
32+
mediaPlayerModelMock = new MediaPlayerModelMock();
33+
34+
catchupController = CatchupController(context).getInstance();
35+
catchupController.setConfig({
36+
videoModel: videoModelMock,
37+
dashMetrics: dashMetricsMock,
38+
streamController: streamControllerMock,
39+
playbackController: playbackControllerMock,
40+
mediaPlayerModel: mediaPlayerModelMock,
41+
settings: settings,
42+
});
43+
44+
streamControllerMock.initialize([streamMock]);
45+
});
46+
47+
afterEach(function () {
48+
catchupController.reset();
49+
catchupController = null;
50+
});
51+
52+
describe('Step Algorithm - _stepNeedToCatchUp', function () {
53+
54+
beforeEach(function () {
55+
let streamInfo = {
56+
manifestInfo: {
57+
isDynamic: true,
58+
availableFrom: new Date()
59+
},
60+
start: 10,
61+
duration: 600
62+
};
63+
64+
catchupController.initialize(streamInfo);
65+
streamMock.initialize(streamInfo);
66+
});
67+
68+
it('should true when current latency below the live delay', function () {
69+
expect(catchupController._stepNeedToCatchUp.bind(catchupController)).not.to.throw();
70+
71+
settings.update({ streaming:
72+
{
73+
delay: { liveDelay: 20 },
74+
catchup:{
75+
step: {
76+
start: { min: 1, max: 1 },
77+
stop: { min: 0.5, max: 0.5 }
78+
},
79+
mode: 'liveCatchupModeStep'
80+
}
81+
}
82+
});
83+
84+
expect(catchupController._stepNeedToCatchUp()).to.be.true;
85+
});
86+
87+
it('should true when current latency above the live delay', function () {
88+
expect(catchupController._stepNeedToCatchUp.bind(catchupController)).not.to.throw();
89+
90+
settings.update({ streaming:
91+
{
92+
delay: { liveDelay: 20 },
93+
catchup:{
94+
step: {
95+
start: { min: 1, max: 1 },
96+
stop: { min: 0.5, max: 0.5 }
97+
},
98+
mode: 'liveCatchupModeStep'
99+
}
100+
}
101+
});
102+
103+
expect(catchupController._stepNeedToCatchUp()).to.be.true;
104+
});
105+
106+
it('should true when current latency between start and stop min live delay', function () {
107+
expect(catchupController._stepNeedToCatchUp.bind(catchupController)).not.to.throw();
108+
109+
settings.update({ streaming:
110+
{
111+
delay: { liveDelay: 20 },
112+
catchup:{
113+
step: {
114+
start: { min: 1, max: 1 },
115+
stop: { min: 0.5, max: 0.5 }
116+
},
117+
mode: 'liveCatchupModeStep'
118+
}
119+
}
120+
});
121+
122+
expect(catchupController._stepNeedToCatchUp()).to.be.true;
123+
});
124+
125+
it('should true when current latency between start and stop max live delay', function () {
126+
expect(catchupController._stepNeedToCatchUp.bind(catchupController)).not.to.throw();
127+
128+
settings.update({ streaming:
129+
{
130+
delay: { liveDelay: 20 },
131+
catchup:{
132+
step: {
133+
start: { min: 1, max: 1 },
134+
stop: { min: 0.5, max: 0.5 }
135+
},
136+
mode: 'liveCatchupModeStep'
137+
}
138+
}
139+
});
140+
141+
expect(catchupController._stepNeedToCatchUp()).to.be.true;
142+
});
143+
144+
})
145+
});

0 commit comments

Comments
 (0)