Skip to content

Commit 8b2e82f

Browse files
committed
chore: Release 0.3
1 parent f14a9ab commit 8b2e82f

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jellyfin-segment-editor",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Manage Intro, Outro and other Segments",
55
"productName": "Jellyfin Segment Editor",
66
"author": "endrl <[email protected]>",

src/composables/videoApi.ts

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,60 @@
11
import { useApiStore } from 'stores/api'
22
import { ItemDto } from 'src/interfaces';
3-
import { CREATOR_UUID } from './constants';
43

54
export function useVideoApi() {
65
const { buildUrl, postJson } = useApiStore()
76

8-
/**
9-
* Get a media stream url by id
10-
* Endpoint: Videos/itemId/master.m3u8 is HLS. HLS supports audio: aac, mp3 ac3, eac3. video container: fMP4, mp2ts
11-
* Doc: https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-20#section-3.1 -3.4
12-
* @param itemId itemId of media
13-
* @param forceVideoReason force transcode of video
14-
* @param forceAudioReason force transcode of audio
15-
* @param container ts, mp4, ...
16-
*/
17-
function getVideoStream(itemId: ItemDto['Id'], forceVideoReason?:string, forceAudioReason?: string, container?: string) {
7+
/**
8+
* Get a media stream url by id
9+
* Endpoint: Videos/itemId/master.m3u8 is HLS. HLS supports audio: aac, mp3 ac3, eac3. video container: fMP4, mp2ts
10+
* Doc: https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-20#section-3.1 -3.4
11+
* @param itemId itemId of media
12+
* @param forceVideoReason force transcode of video
13+
* @param forceAudioReason force transcode of audio
14+
* @param container ts, mp4, ...
15+
*/
16+
function getVideoStream(itemId: ItemDto['Id'], forceVideoReason?: string, forceAudioReason?: string, container?: string) {
1817
const query: Map<string, any> = new Map();
1918
const transcodeReasons: string[] = [];
20-
query.set('MediaSourceId',itemId)
19+
query.set('MediaSourceId', itemId)
2120

2221
// if there is no transcode, enable direct stream
23-
if (!forceAudioReason && !forceVideoReason){
24-
query.set('static',true)
22+
if (!forceAudioReason && !forceVideoReason) {
23+
query.set('static', true)
2524
}
26-
if(forceAudioReason){
25+
if (forceAudioReason) {
2726
transcodeReasons.push(`Audio not supported (${forceAudioReason})`)
28-
query.set('AudioCodec','aac')
29-
query.set('TranscodingMaxAudioChannels',2)
27+
query.set('AudioCodec', 'aac')
28+
query.set('TranscodingMaxAudioChannels', 2)
3029
}
31-
if(forceVideoReason){
30+
if (forceVideoReason) {
3231
transcodeReasons.push(`Video not supported (${forceVideoReason}`)
33-
query.set('VideoCodec','h264')
32+
query.set('VideoCodec', 'h264')
3433
}
35-
if(transcodeReasons.length){
36-
query.set('transcodeReasons',transcodeReasons.join(','))
34+
if (transcodeReasons.length) {
35+
query.set('transcodeReasons', transcodeReasons.join(','))
3736
}
38-
if (container){
39-
query.set('segmentContainer',container)
37+
if (container) {
38+
query.set('segmentContainer', container)
4039
}
4140
// skip session, we can't stop it without userId...
4241
// query.set('PlaySessionId',CREATOR_UUID)
4342

4443
const baseUrl = `Videos/${itemId}/master.m3u8`;
45-
return buildUrl(baseUrl,query)
44+
return buildUrl(baseUrl, query)
4645
}
4746

4847
/**
4948
* Report end of playback. Requires userId from httpContext server side...
5049
* @param itemId
5150
*/
52-
function reportPlayingStop(itemId: ItemDto['Id']){
51+
function reportPlayingStop(itemId: ItemDto['Id']) {
5352
const payload = {
5453
ItemId: itemId,
5554
MediaSourceId: itemId,
56-
PlaySessionId: CREATOR_UUID
55+
PlaySessionId: 'xxx'
5756
}
58-
postJson('Sessions/Playing/Stopped',payload)
57+
postJson('Sessions/Playing/Stopped', payload)
5958
}
6059

6160
return { getVideoStream, reportPlayingStop }

0 commit comments

Comments
 (0)