mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00

Allows: * The HLS player to propose an "Audio only" resolution * The live to output an "Audio only" resolution * The live to ingest and output an "Audio only" stream This feature is under a config for VOD videos and is enabled by default for lives In the future we can imagine: * To propose multiple audio streams for a specific video * To ingest an audio only VOD and just output an audio only "video" (the player would play the audio file and PeerTube would not generate additional resolutions) This commit introduce a new way to download videos: * Add "/download/videos/generate/:videoId" endpoint where PeerTube can mux an audio only and a video only file to a mp4 container * The download client modal introduces a new default panel where the user can choose resolutions it wants to download
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import * as Sequelize from 'sequelize'
|
|
|
|
async function up (utils: {
|
|
transaction: Sequelize.Transaction
|
|
queryInterface: Sequelize.QueryInterface
|
|
sequelize: Sequelize.Sequelize
|
|
}): Promise<void> {
|
|
const { transaction } = utils
|
|
|
|
{
|
|
await utils.queryInterface.addColumn('videoFile', 'formatFlags', {
|
|
type: Sequelize.INTEGER,
|
|
defaultValue: 2, // fragmented
|
|
allowNull: false
|
|
}, { transaction })
|
|
|
|
// Web videos
|
|
const query = 'UPDATE "videoFile" SET "formatFlags" = 1 WHERE "videoId" IS NOT NULL'
|
|
await utils.sequelize.query(query, { transaction })
|
|
|
|
await utils.queryInterface.changeColumn('videoFile', 'formatFlags', {
|
|
type: Sequelize.INTEGER,
|
|
defaultValue: null,
|
|
allowNull: false
|
|
}, { transaction })
|
|
}
|
|
|
|
{
|
|
await utils.queryInterface.addColumn('videoFile', 'streams', {
|
|
type: Sequelize.INTEGER,
|
|
defaultValue: 3, // audio + video
|
|
allowNull: false
|
|
}, { transaction })
|
|
|
|
// Case where there is only an audio stream
|
|
const query = 'UPDATE "videoFile" SET "streams" = 2 WHERE "resolution" = 0'
|
|
await utils.sequelize.query(query, { transaction })
|
|
|
|
await utils.queryInterface.changeColumn('videoFile', 'streams', {
|
|
type: Sequelize.INTEGER,
|
|
defaultValue: null,
|
|
allowNull: false
|
|
}, { transaction })
|
|
}
|
|
}
|
|
|
|
function down (options) {
|
|
throw new Error('Not implemented.')
|
|
}
|
|
|
|
export {
|
|
down, up
|
|
}
|