|
1 | 1 | import DashAdapter from '../../../../src/dash/DashAdapter.js'; |
2 | 2 | import Constants from '../../../../src/streaming/constants/Constants.js'; |
3 | 3 | import DashConstants from '../../../../src/dash/constants/DashConstants.js'; |
4 | | -import {Cta608Parser} from '@svta/common-media-library/cta/608/Cta608Parser'; |
| 4 | +import { Cta608Parser } from '@svta/common-media-library/cta/608/Cta608Parser'; |
5 | 5 | import VoHelper from '../../helpers/VOHelper.js'; |
6 | 6 | import PatchHelper from '../../helpers/PatchHelper.js'; |
7 | 7 | import ErrorHandlerMock from '../../mocks/ErrorHandlerMock.js'; |
8 | 8 | import DescriptorType from '../../../../src/dash/vo/DescriptorType.js'; |
9 | | -import {expect} from 'chai'; |
| 9 | +import { expect } from 'chai'; |
10 | 10 |
|
11 | 11 | const context = {}; |
12 | 12 | const voHelper = new VoHelper(); |
@@ -509,6 +509,34 @@ describe('DashAdapter', function () { |
509 | 509 | expect(voRepresentations).to.be.empty; |
510 | 510 | }); |
511 | 511 |
|
| 512 | + it('should return the adaptation with Role Main when getMainAdaptationForType is called', () => { |
| 513 | + const manifest_with_video = { |
| 514 | + loadedTime: new Date(), |
| 515 | + mediaPresentationDuration: 10, |
| 516 | + Period: [{ |
| 517 | + AdaptationSet: [ |
| 518 | + { |
| 519 | + id: 1, |
| 520 | + mimeType: Constants.VIDEO, |
| 521 | + Role: [{ schemeIdUri: Constants.DASH_ROLE_SCHEME_ID, value: 'alternate' }] |
| 522 | + }, |
| 523 | + { |
| 524 | + id: 2, |
| 525 | + mimeType: Constants.VIDEO, |
| 526 | + Role: [ |
| 527 | + { schemeIdUri: Constants.DASH_ROLE_SCHEME_ID, value: DashConstants.MAIN }, |
| 528 | + { schemeIdUri: Constants.DASH_ROLE_SCHEME_ID, value: 'dub' } |
| 529 | + ] |
| 530 | + } |
| 531 | + ] |
| 532 | + }] |
| 533 | + }; |
| 534 | + dashAdapter.updatePeriods(manifest_with_video); |
| 535 | + const adaptation = dashAdapter.getMainAdaptationForType(Constants.VIDEO, { index: 0 }); |
| 536 | + |
| 537 | + expect(adaptation.id).to.equal(2); |
| 538 | + }); |
| 539 | + |
512 | 540 | it('should return the first adaptation when getMainAdaptationForType is called and streamInfo is undefined', () => { |
513 | 541 | const manifest_with_video = { |
514 | 542 | loadedTime: new Date(), |
|
0 commit comments