-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HLS): Add AES-256 and AES-256-CTR support
- Loading branch information
Showing
17 changed files
with
159 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*! @license | ||
* Shaka Player | ||
* Copyright 2016 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
describe('HlsParser', () => { | ||
const Util = shaka.test.Util; | ||
|
||
/** @type {!jasmine.Spy} */ | ||
let onErrorSpy; | ||
|
||
/** @type {!HTMLVideoElement} */ | ||
let video; | ||
/** @type {shaka.Player} */ | ||
let player; | ||
/** @type {!shaka.util.EventManager} */ | ||
let eventManager; | ||
|
||
let compiledShaka; | ||
|
||
/** @type {!shaka.test.Waiter} */ | ||
let waiter; | ||
|
||
beforeAll(async () => { | ||
video = shaka.test.UiUtils.createVideoElement(); | ||
document.body.appendChild(video); | ||
compiledShaka = | ||
await shaka.test.Loader.loadShaka(getClientArg('uncompiled')); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await shaka.test.TestScheme.createManifests(compiledShaka, '_compiled'); | ||
player = new compiledShaka.Player(); | ||
await player.attach(video); | ||
|
||
// Disable stall detection, which can interfere with playback tests. | ||
player.configure('streaming.stallEnabled', false); | ||
|
||
// Grab event manager from the uncompiled library: | ||
eventManager = new shaka.util.EventManager(); | ||
waiter = new shaka.test.Waiter(eventManager); | ||
waiter.setPlayer(player); | ||
|
||
onErrorSpy = jasmine.createSpy('onError'); | ||
onErrorSpy.and.callFake((event) => fail(event.detail)); | ||
eventManager.listen(player, 'error', Util.spyFunc(onErrorSpy)); | ||
}); | ||
|
||
afterEach(async () => { | ||
eventManager.release(); | ||
await player.destroy(); | ||
}); | ||
|
||
afterAll(() => { | ||
document.body.removeChild(video); | ||
}); | ||
|
||
it('supports AES-128 streaming', async () => { | ||
await player.load('/base/test/test/assets/hls-aes-256/index.m3u8'); | ||
await video.play(); | ||
expect(player.isLive()).toBe(false); | ||
|
||
// Wait for the video to start playback. If it takes longer than 10 | ||
// seconds, fail the test. | ||
await waiter.waitForMovementOrFailOnTimeout(video, 10); | ||
|
||
// Play for 10 seconds, but stop early if the video ends. If it takes | ||
// longer than 30 seconds, fail the test. | ||
await waiter.waitUntilPlayheadReachesOrFailOnTimeout(video, 10, 30); | ||
|
||
await player.unload(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#EXTM3U | ||
#EXT-X-VERSION:6 | ||
#EXT-X-INDEPENDENT-SEGMENTS | ||
|
||
#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=829339,BANDWIDTH=901770,CODECS="avc1.4D400D",RESOLUTION=320x180 | ||
media.m3u8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
��l�t� �^z`vpE_�Kʇ2`b�A�p�T�z |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:4 | ||
#EXT-X-VERSION:7 | ||
#EXT-X-MEDIA-SEQUENCE:1 | ||
#EXT-X-PLAYLIST-TYPE:VOD | ||
#EXT-X-INDEPENDENT-SEGMENTS | ||
#EXT-X-KEY:METHOD=NONE | ||
#EXT-X-KEY:METHOD=AES-256,URI="init.key",IV=0xF9EBE119F65FCF2E5F3FDEEB4A3EB3D5 | ||
#EXT-X-MAP:URI="init.mp4" | ||
|
||
#EXT-X-KEY:METHOD=AES-256,URI="seg0.key",IV=0x3F6DE518DE9A0D8B0FC5EA114ACEDEFA | ||
#EXTINF:4.0 | ||
segment_0.m4s | ||
|
||
#EXT-X-KEY:METHOD=AES-256,URI="seg1.key",IV=0x9DF0B659F52F23C3676C08FE0049500F | ||
#EXTINF:4.0 | ||
segment_1.m4s | ||
|
||
#EXT-X-KEY:METHOD=AES-256-CTR,URI="seg2.key",IV=0xDB67562D1B5F959D1DBA9DD50BF87A52 | ||
#EXTINF:4.0 | ||
segment_2.m4s | ||
|
||
#EXT-X-KEY:METHOD=AES-256-CTR,URI="seg3_and_4.key",IV=0x5161DD0995837650DE5E495DEF6BFBE5 | ||
#EXTINF:4.0 | ||
segment_3.m4s | ||
|
||
#EXT-X-KEY:METHOD=AES-256-CTR,URI="seg3_and_4.key",IV=0x035022245B6DBA858C56F2F0079BAC96 | ||
#EXTINF:4.0 | ||
segment_4.m4s | ||
|
||
#EXT-X-ENDLIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�d������-�EE�I)$���vf@$H���2�I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
���m��]$��_��\݈��fz��C�CX!k�� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
��pf�/`~ | ||
G���41�ZKm"A=qyk��H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
��������C�`��IYS�<jQ��c�J���� |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.