1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 02:09:22 +02:00
Daniel Neto 2023-10-25 10:14:46 -03:00
parent b6d47e94c8
commit 65f15c7e46
2882 changed files with 382239 additions and 10785 deletions

View file

@ -85,6 +85,181 @@ QUnit.test('segment base', function(assert) {
assert.deepEqual(toPlaylists(representations), playlists);
});
QUnit.test('playlist with content steering BaseURLs', function(assert) {
const representations = [
{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn1.example.com/',
clientOffset: 0,
codecs: 'avc1.64001e',
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'alpha',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segmentInfo: {
template: {}
}
},
{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn2.example.com/',
clientOffset: 0,
codecs: 'avc1.64001e',
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'beta',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segmentInfo: {
template: {}
}
},
{
attributes: {
bandwidth: 256,
baseUrl: 'https://example.com/en.vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
sourceDuration: 0,
type: 'dyanmic'
},
segmentInfo: {}
},
{
attributes: {
bandwidth: 256,
baseUrl: 'https://example.com/en.vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
sourceDuration: 0,
type: 'dyanmic'
},
segmentInfo: {}
}
];
const playlists = [{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn1.example.com/',
clientOffset: 0,
codecs: 'avc1.64001e',
duration: 0,
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'alpha',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segments: [
{
duration: 0,
map: {
resolvedUri: 'https://cdn1.example.com/',
uri: ''
},
number: 1,
presentationTime: 0,
resolvedUri: 'https://cdn1.example.com/',
timeline: 0,
uri: ''
}
]
}, {
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn2.example.com/',
clientOffset: 0,
codecs: 'avc1.64001e',
duration: 0,
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'beta',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segments: [
{
duration: 0,
map: {
resolvedUri: 'https://cdn2.example.com/',
uri: ''
},
number: 1,
presentationTime: 0,
resolvedUri: 'https://cdn2.example.com/',
timeline: 0,
uri: ''
}
]
}, {
attributes: {
bandwidth: 256,
baseUrl: 'https://example.com/en.vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
sourceDuration: 0,
type: 'dyanmic'
}
}, {
attributes: {
bandwidth: 256,
baseUrl: 'https://example.com/en.vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
sourceDuration: 0,
type: 'dyanmic'
}
}];
assert.deepEqual(toPlaylists(representations), playlists);
});
QUnit.test('segment base with sidx', function(assert) {
const representations = [{
attributes: {
@ -235,3 +410,204 @@ QUnit.test('presentationTime accounts for presentationTimeOffset', function(asse
assert.deepEqual(toPlaylists(representations), playlists);
});
QUnit.test('playlist with content steering and resolvable BaseURLs', function(assert) {
const representations = [
{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn1.example.com/video',
clientOffset: 0,
codecs: 'avc1.64001e',
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'alpha',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segmentInfo: {
template: {}
}
},
{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn2.example.com/video',
clientOffset: 0,
codecs: 'avc1.64001e',
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'beta',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segmentInfo: {
template: {}
}
},
{
attributes: {
bandwidth: 256,
baseUrl: 'https://cdn1.example.com/vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
serviceLocation: 'alpha',
sourceDuration: 0,
type: 'dyanmic'
},
segmentInfo: {
template: {}
}
},
{
attributes: {
bandwidth: 256,
baseUrl: 'https://cdn2.example.com/vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
serviceLocation: 'beta',
sourceDuration: 0,
type: 'dyanmic'
},
segmentInfo: {}
}
];
const playlists = [
{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn1.example.com/video',
clientOffset: 0,
codecs: 'avc1.64001e',
duration: 0,
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'alpha',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segments: [
{
duration: 0,
map: {
resolvedUri: 'https://cdn1.example.com/video',
uri: ''
},
number: 1,
presentationTime: 0,
resolvedUri: 'https://cdn1.example.com/video',
timeline: 0,
uri: ''
}
]
},
{
attributes: {
bandwidth: 5000000,
baseUrl: 'https://cdn2.example.com/video',
clientOffset: 0,
codecs: 'avc1.64001e',
duration: 0,
height: 404,
id: 'test',
mimeType: 'video/mp4',
periodStart: 0,
role: {
value: 'main'
},
serviceLocation: 'beta',
sourceDuration: 0,
type: 'dyanmic',
width: 720
},
segments: [
{
duration: 0,
map: {
resolvedUri: 'https://cdn2.example.com/video',
uri: ''
},
number: 1,
presentationTime: 0,
resolvedUri: 'https://cdn2.example.com/video',
timeline: 0,
uri: ''
}
]
},
{
attributes: {
bandwidth: 256,
baseUrl: 'https://cdn1.example.com/vtt',
clientOffset: 0,
duration: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
serviceLocation: 'alpha',
sourceDuration: 0,
type: 'dyanmic'
},
segments: [
{
duration: 0,
map: {
resolvedUri: 'https://cdn1.example.com/vtt',
uri: ''
},
number: 1,
presentationTime: 0,
resolvedUri: 'https://cdn1.example.com/vtt',
timeline: 0,
uri: ''
}
]
},
{
attributes: {
bandwidth: 256,
baseUrl: 'https://cdn2.example.com/vtt',
clientOffset: 0,
id: 'en',
lang: 'en',
mimeType: 'text/vtt',
periodStart: 0,
role: {},
serviceLocation: 'beta',
sourceDuration: 0,
type: 'dyanmic'
}
}
];
assert.deepEqual(toPlaylists(representations), playlists);
});