-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from OwenRay/feature/playqueue
Feature/playqueue
- Loading branch information
Showing
60 changed files
with
1,188 additions
and
348 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ ffmpeg.exe | |
ffprobe.exe | ||
*.iml | ||
data/ | ||
*.rbw | ||
*.tgz | ||
dist | ||
platform_scripts/nasos/source/rms |
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 |
---|---|---|
|
@@ -7,3 +7,7 @@ db | |
ffprobe | ||
ffmpeg.exe | ||
ffprobe.exe | ||
platform_scripts | ||
*.rbw | ||
*.tgz | ||
dist |
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
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,41 @@ | ||
const httpServer = require('../../core/http'); | ||
const RequestHandler = require('../../core/http/RequestHandler'); | ||
const fs = require('fs'); | ||
const Mpeg4Container = require('./Mpeg4Container.js'); | ||
const HLSContainer = require('./HLSContainer.js'); | ||
|
||
const containers = { | ||
mpeg4: Mpeg4Container, | ||
hls: HLSContainer, | ||
}; | ||
|
||
// read all the profiles, parse their json and add remember the filename for reference | ||
const profileDir = `${__dirname}/profiles/`; | ||
const profiles = fs.readdirSync(profileDir) | ||
.map(filename => ({ | ||
name: filename.split('.')[0], | ||
...(JSON.parse(fs.readFileSync(`${profileDir}${filename}`))), | ||
})) | ||
.sort((a, b) => b.priority - a.priority); | ||
|
||
class PlayHandler extends RequestHandler { | ||
handleRequest() { | ||
const { query } = this.context; | ||
|
||
const ua = this.request.headers['user-agent']; | ||
let profile; | ||
if (query.profile) { | ||
profile = profiles.find(p => p.name === query.profile); | ||
} | ||
if (!profile) { | ||
profile = profiles.find(p => p.useragent && ua.match(new RegExp(p.useragent))); | ||
} | ||
|
||
const Container = containers[profile.container]; | ||
const container = new Container(this.context, this.method, this.path); | ||
return container.handleRequest(profile); | ||
} | ||
} | ||
|
||
httpServer.registerRoute('get', '/ply/:id', PlayHandler, false, 0); | ||
httpServer.registerRoute('get', '/ply/:id/:offset', PlayHandler, false, 0); |
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,26 @@ | ||
{ | ||
"useragent": "^.*aarch64.*Chrome.*CrKey.*$", | ||
"priority": 1, | ||
"container": "mpeg4", | ||
"encoder": { | ||
"audio": "aac", | ||
"video": "libx264" | ||
}, | ||
"demux": { | ||
"video": [ | ||
"h264", | ||
"hevc" | ||
], | ||
"audio": [ | ||
] | ||
}, | ||
"ffmpegArguments": { | ||
"output": [ | ||
"-movflags", "empty_moov+omit_tfhd_offset+default_base_moof+frag_keyframe", | ||
"-reset_timestamps", "1" | ||
], | ||
"input": [ | ||
|
||
] | ||
} | ||
} |
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,25 @@ | ||
{ | ||
"useragent": "^.*$", | ||
"priority": 0, | ||
"container": "mpeg4", | ||
"encoder": { | ||
"audio": "aac", | ||
"video": "libx264" | ||
}, | ||
"demux": { | ||
"video": [ | ||
"h264" | ||
], | ||
"audio": [ | ||
] | ||
}, | ||
"ffmpegArguments": { | ||
"output": [ | ||
"-movflags", "empty_moov+omit_tfhd_offset+default_base_moof+frag_keyframe", | ||
"-reset_timestamps", "1" | ||
], | ||
"input": [ | ||
|
||
] | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
backend/modules/ffmpeg/profiles/hls_for_offline_playback.json
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,26 @@ | ||
{ | ||
"priority": 0, | ||
"container": "hls", | ||
"neverPause": true, | ||
"encoder": { | ||
"audio": "aac", | ||
"video": "libx264" | ||
}, | ||
"demux": { | ||
"video": [ | ||
"h264" | ||
], | ||
"audio": [ | ||
] | ||
}, | ||
"ffmpegArguments": { | ||
"output": [ | ||
"-hls_time", 30, | ||
"-hls_list_size", 0, | ||
"-bsf:v", "h264_mp4toannexb" | ||
], | ||
"input": [ | ||
|
||
] | ||
} | ||
} |
Oops, something went wrong.