mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-24 15:21:54 +00:00
feat(toDash)!: Add support for generating manifests for Post Live DVR videos (#580)
BREAKING CHANGES: The `duration` property in `StreamingInfo` has been replaced by the asynchronous `getDuration()` function, as getting the duration of Post Live DVR videos requires making a fetch request.
This commit is contained in:
@@ -1,11 +1,32 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
|
||||
export interface LiveStoryboardData {
|
||||
type: 'live',
|
||||
template_url: string,
|
||||
thumbnail_width: number,
|
||||
thumbnail_height: number,
|
||||
columns: number,
|
||||
rows: number
|
||||
}
|
||||
|
||||
export default class PlayerLiveStoryboardSpec extends YTNode {
|
||||
static type = 'PlayerLiveStoryboardSpec';
|
||||
|
||||
constructor() {
|
||||
board: LiveStoryboardData;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
// TODO: A little bit different from PlayerLiveStoryboardSpec
|
||||
// https://i.ytimg.com/sb/5qap5aO4i9A/storyboard_live_90_2x2_b2/M$M.jpg?rs=AOn4CLC9s6IeOsw_gKvEbsbU9y-e2FVRTw#159#90#2#2
|
||||
|
||||
const [ template_url, thumbnail_width, thumbnail_height, columns, rows ] = data.spec.split('#');
|
||||
|
||||
this.board = {
|
||||
type: 'live',
|
||||
template_url,
|
||||
thumbnail_width: parseInt(thumbnail_width, 10),
|
||||
thumbnail_height: parseInt(thumbnail_height, 10),
|
||||
columns: parseInt(columns, 10),
|
||||
rows: parseInt(rows, 10)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
|
||||
export interface StoryboardData {
|
||||
type: 'vod'
|
||||
template_url: string;
|
||||
thumbnail_width: number;
|
||||
thumbnail_height: number;
|
||||
@@ -31,6 +32,7 @@ export default class PlayerStoryboardSpec extends YTNode {
|
||||
const storyboard_count = Math.ceil(parseInt(thumbnail_count, 10) / (parseInt(columns, 10) * parseInt(rows, 10)));
|
||||
|
||||
return {
|
||||
type: 'vod',
|
||||
template_url: url.toString().replace('$L', i).replace('$N', name),
|
||||
thumbnail_width: parseInt(thumbnail_width, 10),
|
||||
thumbnail_height: parseInt(thumbnail_height, 10),
|
||||
|
||||
Reference in New Issue
Block a user