jellyfin-discord-bot/jellyfin/api/audioApi.ts
2023-04-15 22:02:40 +02:00

1334 lines
68 KiB
TypeScript

/**
* Jellyfin API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 10.8.9
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { EncodingContext } from '../model/encodingContext';
import { SubtitleDeliveryMethod } from '../model/subtitleDeliveryMethod';
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
import { HttpError, RequestFile } from './apis';
let defaultBasePath = 'http://localhost';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
export enum AudioApiApiKeys {
CustomAuthentication,
}
export class AudioApi {
protected _basePath = defaultBasePath;
protected _defaultHeaders : any = {};
protected _useQuerystring : boolean = false;
protected authentications = {
'default': <Authentication>new VoidAuth(),
'CustomAuthentication': new ApiKeyAuth('header', 'Authorization'),
}
protected interceptors: Interceptor[] = [];
constructor(basePath?: string);
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
if (password) {
if (basePath) {
this.basePath = basePath;
}
} else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername
}
}
}
set useQuerystring(value: boolean) {
this._useQuerystring = value;
}
set basePath(basePath: string) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders: any) {
this._defaultHeaders = defaultHeaders;
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
public setDefaultAuthentication(auth: Authentication) {
this.authentications.default = auth;
}
public setApiKey(key: AudioApiApiKeys, value: string) {
(this.authentications as any)[AudioApiApiKeys[key]].apiKey = value;
}
public addInterceptor(interceptor: Interceptor) {
this.interceptors.push(interceptor);
}
/**
*
* @summary Gets an audio stream.
* @param itemId The item id.
* @param container The audio container.
* @param _static Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.
* @param params The streaming parameters.
* @param tag The tag.
* @param deviceProfileId Optional. The dlna device profile id to utilize.
* @param playSessionId The play session id.
* @param segmentContainer The segment container.
* @param segmentLength The segment length.
* @param minSegments The minimum number of segments.
* @param mediaSourceId The media version id, if playing an alternate version.
* @param deviceId The device id of the client requesting. Used to stop encoding processes when needed.
* @param audioCodec Optional. Specify a audio codec to encode to, e.g. mp3. If omitted the server will auto-select using the url\&#39;s extension. Options: aac, mp3, vorbis, wma.
* @param enableAutoStreamCopy Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.
* @param allowVideoStreamCopy Whether or not to allow copying of the video stream url.
* @param allowAudioStreamCopy Whether or not to allow copying of the audio stream url.
* @param breakOnNonKeyFrames Optional. Whether to break on non key frames.
* @param audioSampleRate Optional. Specify a specific audio sample rate, e.g. 44100.
* @param maxAudioBitDepth Optional. The maximum audio bit depth.
* @param audioBitRate Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.
* @param audioChannels Optional. Specify a specific number of audio channels to encode to, e.g. 2.
* @param maxAudioChannels Optional. Specify a maximum number of audio channels to encode to, e.g. 2.
* @param profile Optional. Specify a specific an encoder profile (varies by encoder), e.g. main, baseline, high.
* @param level Optional. Specify a level for the encoder profile (varies by encoder), e.g. 3, 3.1.
* @param framerate Optional. A specific video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param maxFramerate Optional. A specific maximum video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param copyTimestamps Whether or not to copy timestamps when transcoding with an offset. Defaults to false.
* @param startTimeTicks Optional. Specify a starting offset, in ticks. 1 tick &#x3D; 10000 ms.
* @param width Optional. The fixed horizontal resolution of the encoded video.
* @param height Optional. The fixed vertical resolution of the encoded video.
* @param videoBitRate Optional. Specify a video bitrate to encode to, e.g. 500000. If omitted this will be left to encoder defaults.
* @param subtitleStreamIndex Optional. The index of the subtitle stream to use. If omitted no subtitles will be used.
* @param subtitleMethod Optional. Specify the subtitle delivery method.
* @param maxRefFrames Optional.
* @param maxVideoBitDepth Optional. The maximum video bit depth.
* @param requireAvc Optional. Whether to require avc.
* @param deInterlace Optional. Whether to deinterlace the video.
* @param requireNonAnamorphic Optional. Whether to require a non anamorphic stream.
* @param transcodingMaxAudioChannels Optional. The maximum number of audio channels to transcode.
* @param cpuCoreLimit Optional. The limit of how many cpu cores to use.
* @param liveStreamId The live stream id.
* @param enableMpegtsM2TsMode Optional. Whether to enable the MpegtsM2Ts mode.
* @param videoCodec Optional. Specify a video codec to encode to, e.g. h264. If omitted the server will auto-select using the url\&#39;s extension. Options: h265, h264, mpeg4, theora, vp8, vp9, vpx (deprecated), wmv.
* @param subtitleCodec Optional. Specify a subtitle codec to encode to.
* @param transcodeReasons Optional. The transcoding reason.
* @param audioStreamIndex Optional. The index of the audio stream to use. If omitted the first audio stream will be used.
* @param videoStreamIndex Optional. The index of the video stream to use. If omitted the first video stream will be used.
* @param context Optional. The MediaBrowser.Model.Dlna.EncodingContext.
* @param streamOptions Optional. The streaming options.
*/
public async getAudioStream (itemId: string, container?: string, _static?: boolean, params?: string, tag?: string, deviceProfileId?: string, playSessionId?: string, segmentContainer?: string, segmentLength?: number, minSegments?: number, mediaSourceId?: string, deviceId?: string, audioCodec?: string, enableAutoStreamCopy?: boolean, allowVideoStreamCopy?: boolean, allowAudioStreamCopy?: boolean, breakOnNonKeyFrames?: boolean, audioSampleRate?: number, maxAudioBitDepth?: number, audioBitRate?: number, audioChannels?: number, maxAudioChannels?: number, profile?: string, level?: string, framerate?: number, maxFramerate?: number, copyTimestamps?: boolean, startTimeTicks?: number, width?: number, height?: number, videoBitRate?: number, subtitleStreamIndex?: number, subtitleMethod?: SubtitleDeliveryMethod, maxRefFrames?: number, maxVideoBitDepth?: number, requireAvc?: boolean, deInterlace?: boolean, requireNonAnamorphic?: boolean, transcodingMaxAudioChannels?: number, cpuCoreLimit?: number, liveStreamId?: string, enableMpegtsM2TsMode?: boolean, videoCodec?: string, subtitleCodec?: string, transcodeReasons?: string, audioStreamIndex?: number, videoStreamIndex?: number, context?: EncodingContext, streamOptions?: { [key: string]: string; }, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
const localVarPath = this.basePath + '/Audio/{itemId}/stream'
.replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['audio/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'itemId' is not null or undefined
if (itemId === null || itemId === undefined) {
throw new Error('Required parameter itemId was null or undefined when calling getAudioStream.');
}
if (container !== undefined) {
localVarQueryParameters['container'] = ObjectSerializer.serialize(container, "string");
}
if (_static !== undefined) {
localVarQueryParameters['static'] = ObjectSerializer.serialize(_static, "boolean");
}
if (params !== undefined) {
localVarQueryParameters['params'] = ObjectSerializer.serialize(params, "string");
}
if (tag !== undefined) {
localVarQueryParameters['tag'] = ObjectSerializer.serialize(tag, "string");
}
if (deviceProfileId !== undefined) {
localVarQueryParameters['deviceProfileId'] = ObjectSerializer.serialize(deviceProfileId, "string");
}
if (playSessionId !== undefined) {
localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string");
}
if (segmentContainer !== undefined) {
localVarQueryParameters['segmentContainer'] = ObjectSerializer.serialize(segmentContainer, "string");
}
if (segmentLength !== undefined) {
localVarQueryParameters['segmentLength'] = ObjectSerializer.serialize(segmentLength, "number");
}
if (minSegments !== undefined) {
localVarQueryParameters['minSegments'] = ObjectSerializer.serialize(minSegments, "number");
}
if (mediaSourceId !== undefined) {
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
}
if (deviceId !== undefined) {
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
}
if (audioCodec !== undefined) {
localVarQueryParameters['audioCodec'] = ObjectSerializer.serialize(audioCodec, "string");
}
if (enableAutoStreamCopy !== undefined) {
localVarQueryParameters['enableAutoStreamCopy'] = ObjectSerializer.serialize(enableAutoStreamCopy, "boolean");
}
if (allowVideoStreamCopy !== undefined) {
localVarQueryParameters['allowVideoStreamCopy'] = ObjectSerializer.serialize(allowVideoStreamCopy, "boolean");
}
if (allowAudioStreamCopy !== undefined) {
localVarQueryParameters['allowAudioStreamCopy'] = ObjectSerializer.serialize(allowAudioStreamCopy, "boolean");
}
if (breakOnNonKeyFrames !== undefined) {
localVarQueryParameters['breakOnNonKeyFrames'] = ObjectSerializer.serialize(breakOnNonKeyFrames, "boolean");
}
if (audioSampleRate !== undefined) {
localVarQueryParameters['audioSampleRate'] = ObjectSerializer.serialize(audioSampleRate, "number");
}
if (maxAudioBitDepth !== undefined) {
localVarQueryParameters['maxAudioBitDepth'] = ObjectSerializer.serialize(maxAudioBitDepth, "number");
}
if (audioBitRate !== undefined) {
localVarQueryParameters['audioBitRate'] = ObjectSerializer.serialize(audioBitRate, "number");
}
if (audioChannels !== undefined) {
localVarQueryParameters['audioChannels'] = ObjectSerializer.serialize(audioChannels, "number");
}
if (maxAudioChannels !== undefined) {
localVarQueryParameters['maxAudioChannels'] = ObjectSerializer.serialize(maxAudioChannels, "number");
}
if (profile !== undefined) {
localVarQueryParameters['profile'] = ObjectSerializer.serialize(profile, "string");
}
if (level !== undefined) {
localVarQueryParameters['level'] = ObjectSerializer.serialize(level, "string");
}
if (framerate !== undefined) {
localVarQueryParameters['framerate'] = ObjectSerializer.serialize(framerate, "number");
}
if (maxFramerate !== undefined) {
localVarQueryParameters['maxFramerate'] = ObjectSerializer.serialize(maxFramerate, "number");
}
if (copyTimestamps !== undefined) {
localVarQueryParameters['copyTimestamps'] = ObjectSerializer.serialize(copyTimestamps, "boolean");
}
if (startTimeTicks !== undefined) {
localVarQueryParameters['startTimeTicks'] = ObjectSerializer.serialize(startTimeTicks, "number");
}
if (width !== undefined) {
localVarQueryParameters['width'] = ObjectSerializer.serialize(width, "number");
}
if (height !== undefined) {
localVarQueryParameters['height'] = ObjectSerializer.serialize(height, "number");
}
if (videoBitRate !== undefined) {
localVarQueryParameters['videoBitRate'] = ObjectSerializer.serialize(videoBitRate, "number");
}
if (subtitleStreamIndex !== undefined) {
localVarQueryParameters['subtitleStreamIndex'] = ObjectSerializer.serialize(subtitleStreamIndex, "number");
}
if (subtitleMethod !== undefined) {
localVarQueryParameters['subtitleMethod'] = ObjectSerializer.serialize(subtitleMethod, "SubtitleDeliveryMethod");
}
if (maxRefFrames !== undefined) {
localVarQueryParameters['maxRefFrames'] = ObjectSerializer.serialize(maxRefFrames, "number");
}
if (maxVideoBitDepth !== undefined) {
localVarQueryParameters['maxVideoBitDepth'] = ObjectSerializer.serialize(maxVideoBitDepth, "number");
}
if (requireAvc !== undefined) {
localVarQueryParameters['requireAvc'] = ObjectSerializer.serialize(requireAvc, "boolean");
}
if (deInterlace !== undefined) {
localVarQueryParameters['deInterlace'] = ObjectSerializer.serialize(deInterlace, "boolean");
}
if (requireNonAnamorphic !== undefined) {
localVarQueryParameters['requireNonAnamorphic'] = ObjectSerializer.serialize(requireNonAnamorphic, "boolean");
}
if (transcodingMaxAudioChannels !== undefined) {
localVarQueryParameters['transcodingMaxAudioChannels'] = ObjectSerializer.serialize(transcodingMaxAudioChannels, "number");
}
if (cpuCoreLimit !== undefined) {
localVarQueryParameters['cpuCoreLimit'] = ObjectSerializer.serialize(cpuCoreLimit, "number");
}
if (liveStreamId !== undefined) {
localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string");
}
if (enableMpegtsM2TsMode !== undefined) {
localVarQueryParameters['enableMpegtsM2TsMode'] = ObjectSerializer.serialize(enableMpegtsM2TsMode, "boolean");
}
if (videoCodec !== undefined) {
localVarQueryParameters['videoCodec'] = ObjectSerializer.serialize(videoCodec, "string");
}
if (subtitleCodec !== undefined) {
localVarQueryParameters['subtitleCodec'] = ObjectSerializer.serialize(subtitleCodec, "string");
}
if (transcodeReasons !== undefined) {
localVarQueryParameters['transcodeReasons'] = ObjectSerializer.serialize(transcodeReasons, "string");
}
if (audioStreamIndex !== undefined) {
localVarQueryParameters['audioStreamIndex'] = ObjectSerializer.serialize(audioStreamIndex, "number");
}
if (videoStreamIndex !== undefined) {
localVarQueryParameters['videoStreamIndex'] = ObjectSerializer.serialize(videoStreamIndex, "number");
}
if (context !== undefined) {
localVarQueryParameters['context'] = ObjectSerializer.serialize(context, "EncodingContext");
}
if (streamOptions !== undefined) {
localVarQueryParameters['streamOptions'] = ObjectSerializer.serialize(streamOptions, "{ [key: string]: string; }");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
encoding: null,
};
let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Buffer");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets an audio stream.
* @param itemId The item id.
* @param container The audio container.
* @param _static Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.
* @param params The streaming parameters.
* @param tag The tag.
* @param deviceProfileId Optional. The dlna device profile id to utilize.
* @param playSessionId The play session id.
* @param segmentContainer The segment container.
* @param segmentLength The segment lenght.
* @param minSegments The minimum number of segments.
* @param mediaSourceId The media version id, if playing an alternate version.
* @param deviceId The device id of the client requesting. Used to stop encoding processes when needed.
* @param audioCodec Optional. Specify a audio codec to encode to, e.g. mp3. If omitted the server will auto-select using the url\&#39;s extension. Options: aac, mp3, vorbis, wma.
* @param enableAutoStreamCopy Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.
* @param allowVideoStreamCopy Whether or not to allow copying of the video stream url.
* @param allowAudioStreamCopy Whether or not to allow copying of the audio stream url.
* @param breakOnNonKeyFrames Optional. Whether to break on non key frames.
* @param audioSampleRate Optional. Specify a specific audio sample rate, e.g. 44100.
* @param maxAudioBitDepth Optional. The maximum audio bit depth.
* @param audioBitRate Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.
* @param audioChannels Optional. Specify a specific number of audio channels to encode to, e.g. 2.
* @param maxAudioChannels Optional. Specify a maximum number of audio channels to encode to, e.g. 2.
* @param profile Optional. Specify a specific an encoder profile (varies by encoder), e.g. main, baseline, high.
* @param level Optional. Specify a level for the encoder profile (varies by encoder), e.g. 3, 3.1.
* @param framerate Optional. A specific video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param maxFramerate Optional. A specific maximum video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param copyTimestamps Whether or not to copy timestamps when transcoding with an offset. Defaults to false.
* @param startTimeTicks Optional. Specify a starting offset, in ticks. 1 tick &#x3D; 10000 ms.
* @param width Optional. The fixed horizontal resolution of the encoded video.
* @param height Optional. The fixed vertical resolution of the encoded video.
* @param videoBitRate Optional. Specify a video bitrate to encode to, e.g. 500000. If omitted this will be left to encoder defaults.
* @param subtitleStreamIndex Optional. The index of the subtitle stream to use. If omitted no subtitles will be used.
* @param subtitleMethod Optional. Specify the subtitle delivery method.
* @param maxRefFrames Optional.
* @param maxVideoBitDepth Optional. The maximum video bit depth.
* @param requireAvc Optional. Whether to require avc.
* @param deInterlace Optional. Whether to deinterlace the video.
* @param requireNonAnamorphic Optional. Whether to require a non anamporphic stream.
* @param transcodingMaxAudioChannels Optional. The maximum number of audio channels to transcode.
* @param cpuCoreLimit Optional. The limit of how many cpu cores to use.
* @param liveStreamId The live stream id.
* @param enableMpegtsM2TsMode Optional. Whether to enable the MpegtsM2Ts mode.
* @param videoCodec Optional. Specify a video codec to encode to, e.g. h264. If omitted the server will auto-select using the url\&#39;s extension. Options: h265, h264, mpeg4, theora, vp8, vp9, vpx (deprecated), wmv.
* @param subtitleCodec Optional. Specify a subtitle codec to encode to.
* @param transcodeReasons Optional. The transcoding reason.
* @param audioStreamIndex Optional. The index of the audio stream to use. If omitted the first audio stream will be used.
* @param videoStreamIndex Optional. The index of the video stream to use. If omitted the first video stream will be used.
* @param context Optional. The MediaBrowser.Model.Dlna.EncodingContext.
* @param streamOptions Optional. The streaming options.
*/
public async getAudioStreamByContainer (itemId: string, container: string, _static?: boolean, params?: string, tag?: string, deviceProfileId?: string, playSessionId?: string, segmentContainer?: string, segmentLength?: number, minSegments?: number, mediaSourceId?: string, deviceId?: string, audioCodec?: string, enableAutoStreamCopy?: boolean, allowVideoStreamCopy?: boolean, allowAudioStreamCopy?: boolean, breakOnNonKeyFrames?: boolean, audioSampleRate?: number, maxAudioBitDepth?: number, audioBitRate?: number, audioChannels?: number, maxAudioChannels?: number, profile?: string, level?: string, framerate?: number, maxFramerate?: number, copyTimestamps?: boolean, startTimeTicks?: number, width?: number, height?: number, videoBitRate?: number, subtitleStreamIndex?: number, subtitleMethod?: SubtitleDeliveryMethod, maxRefFrames?: number, maxVideoBitDepth?: number, requireAvc?: boolean, deInterlace?: boolean, requireNonAnamorphic?: boolean, transcodingMaxAudioChannels?: number, cpuCoreLimit?: number, liveStreamId?: string, enableMpegtsM2TsMode?: boolean, videoCodec?: string, subtitleCodec?: string, transcodeReasons?: string, audioStreamIndex?: number, videoStreamIndex?: number, context?: EncodingContext, streamOptions?: { [key: string]: string; }, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
const localVarPath = this.basePath + '/Audio/{itemId}/stream.{container}'
.replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId)))
.replace('{' + 'container' + '}', encodeURIComponent(String(container)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['audio/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'itemId' is not null or undefined
if (itemId === null || itemId === undefined) {
throw new Error('Required parameter itemId was null or undefined when calling getAudioStreamByContainer.');
}
// verify required parameter 'container' is not null or undefined
if (container === null || container === undefined) {
throw new Error('Required parameter container was null or undefined when calling getAudioStreamByContainer.');
}
if (_static !== undefined) {
localVarQueryParameters['static'] = ObjectSerializer.serialize(_static, "boolean");
}
if (params !== undefined) {
localVarQueryParameters['params'] = ObjectSerializer.serialize(params, "string");
}
if (tag !== undefined) {
localVarQueryParameters['tag'] = ObjectSerializer.serialize(tag, "string");
}
if (deviceProfileId !== undefined) {
localVarQueryParameters['deviceProfileId'] = ObjectSerializer.serialize(deviceProfileId, "string");
}
if (playSessionId !== undefined) {
localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string");
}
if (segmentContainer !== undefined) {
localVarQueryParameters['segmentContainer'] = ObjectSerializer.serialize(segmentContainer, "string");
}
if (segmentLength !== undefined) {
localVarQueryParameters['segmentLength'] = ObjectSerializer.serialize(segmentLength, "number");
}
if (minSegments !== undefined) {
localVarQueryParameters['minSegments'] = ObjectSerializer.serialize(minSegments, "number");
}
if (mediaSourceId !== undefined) {
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
}
if (deviceId !== undefined) {
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
}
if (audioCodec !== undefined) {
localVarQueryParameters['audioCodec'] = ObjectSerializer.serialize(audioCodec, "string");
}
if (enableAutoStreamCopy !== undefined) {
localVarQueryParameters['enableAutoStreamCopy'] = ObjectSerializer.serialize(enableAutoStreamCopy, "boolean");
}
if (allowVideoStreamCopy !== undefined) {
localVarQueryParameters['allowVideoStreamCopy'] = ObjectSerializer.serialize(allowVideoStreamCopy, "boolean");
}
if (allowAudioStreamCopy !== undefined) {
localVarQueryParameters['allowAudioStreamCopy'] = ObjectSerializer.serialize(allowAudioStreamCopy, "boolean");
}
if (breakOnNonKeyFrames !== undefined) {
localVarQueryParameters['breakOnNonKeyFrames'] = ObjectSerializer.serialize(breakOnNonKeyFrames, "boolean");
}
if (audioSampleRate !== undefined) {
localVarQueryParameters['audioSampleRate'] = ObjectSerializer.serialize(audioSampleRate, "number");
}
if (maxAudioBitDepth !== undefined) {
localVarQueryParameters['maxAudioBitDepth'] = ObjectSerializer.serialize(maxAudioBitDepth, "number");
}
if (audioBitRate !== undefined) {
localVarQueryParameters['audioBitRate'] = ObjectSerializer.serialize(audioBitRate, "number");
}
if (audioChannels !== undefined) {
localVarQueryParameters['audioChannels'] = ObjectSerializer.serialize(audioChannels, "number");
}
if (maxAudioChannels !== undefined) {
localVarQueryParameters['maxAudioChannels'] = ObjectSerializer.serialize(maxAudioChannels, "number");
}
if (profile !== undefined) {
localVarQueryParameters['profile'] = ObjectSerializer.serialize(profile, "string");
}
if (level !== undefined) {
localVarQueryParameters['level'] = ObjectSerializer.serialize(level, "string");
}
if (framerate !== undefined) {
localVarQueryParameters['framerate'] = ObjectSerializer.serialize(framerate, "number");
}
if (maxFramerate !== undefined) {
localVarQueryParameters['maxFramerate'] = ObjectSerializer.serialize(maxFramerate, "number");
}
if (copyTimestamps !== undefined) {
localVarQueryParameters['copyTimestamps'] = ObjectSerializer.serialize(copyTimestamps, "boolean");
}
if (startTimeTicks !== undefined) {
localVarQueryParameters['startTimeTicks'] = ObjectSerializer.serialize(startTimeTicks, "number");
}
if (width !== undefined) {
localVarQueryParameters['width'] = ObjectSerializer.serialize(width, "number");
}
if (height !== undefined) {
localVarQueryParameters['height'] = ObjectSerializer.serialize(height, "number");
}
if (videoBitRate !== undefined) {
localVarQueryParameters['videoBitRate'] = ObjectSerializer.serialize(videoBitRate, "number");
}
if (subtitleStreamIndex !== undefined) {
localVarQueryParameters['subtitleStreamIndex'] = ObjectSerializer.serialize(subtitleStreamIndex, "number");
}
if (subtitleMethod !== undefined) {
localVarQueryParameters['subtitleMethod'] = ObjectSerializer.serialize(subtitleMethod, "SubtitleDeliveryMethod");
}
if (maxRefFrames !== undefined) {
localVarQueryParameters['maxRefFrames'] = ObjectSerializer.serialize(maxRefFrames, "number");
}
if (maxVideoBitDepth !== undefined) {
localVarQueryParameters['maxVideoBitDepth'] = ObjectSerializer.serialize(maxVideoBitDepth, "number");
}
if (requireAvc !== undefined) {
localVarQueryParameters['requireAvc'] = ObjectSerializer.serialize(requireAvc, "boolean");
}
if (deInterlace !== undefined) {
localVarQueryParameters['deInterlace'] = ObjectSerializer.serialize(deInterlace, "boolean");
}
if (requireNonAnamorphic !== undefined) {
localVarQueryParameters['requireNonAnamorphic'] = ObjectSerializer.serialize(requireNonAnamorphic, "boolean");
}
if (transcodingMaxAudioChannels !== undefined) {
localVarQueryParameters['transcodingMaxAudioChannels'] = ObjectSerializer.serialize(transcodingMaxAudioChannels, "number");
}
if (cpuCoreLimit !== undefined) {
localVarQueryParameters['cpuCoreLimit'] = ObjectSerializer.serialize(cpuCoreLimit, "number");
}
if (liveStreamId !== undefined) {
localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string");
}
if (enableMpegtsM2TsMode !== undefined) {
localVarQueryParameters['enableMpegtsM2TsMode'] = ObjectSerializer.serialize(enableMpegtsM2TsMode, "boolean");
}
if (videoCodec !== undefined) {
localVarQueryParameters['videoCodec'] = ObjectSerializer.serialize(videoCodec, "string");
}
if (subtitleCodec !== undefined) {
localVarQueryParameters['subtitleCodec'] = ObjectSerializer.serialize(subtitleCodec, "string");
}
if (transcodeReasons !== undefined) {
localVarQueryParameters['transcodeReasons'] = ObjectSerializer.serialize(transcodeReasons, "string");
}
if (audioStreamIndex !== undefined) {
localVarQueryParameters['audioStreamIndex'] = ObjectSerializer.serialize(audioStreamIndex, "number");
}
if (videoStreamIndex !== undefined) {
localVarQueryParameters['videoStreamIndex'] = ObjectSerializer.serialize(videoStreamIndex, "number");
}
if (context !== undefined) {
localVarQueryParameters['context'] = ObjectSerializer.serialize(context, "EncodingContext");
}
if (streamOptions !== undefined) {
localVarQueryParameters['streamOptions'] = ObjectSerializer.serialize(streamOptions, "{ [key: string]: string; }");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
encoding: null,
};
let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Buffer");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets an audio stream.
* @param itemId The item id.
* @param container The audio container.
* @param _static Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.
* @param params The streaming parameters.
* @param tag The tag.
* @param deviceProfileId Optional. The dlna device profile id to utilize.
* @param playSessionId The play session id.
* @param segmentContainer The segment container.
* @param segmentLength The segment length.
* @param minSegments The minimum number of segments.
* @param mediaSourceId The media version id, if playing an alternate version.
* @param deviceId The device id of the client requesting. Used to stop encoding processes when needed.
* @param audioCodec Optional. Specify a audio codec to encode to, e.g. mp3. If omitted the server will auto-select using the url\&#39;s extension. Options: aac, mp3, vorbis, wma.
* @param enableAutoStreamCopy Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.
* @param allowVideoStreamCopy Whether or not to allow copying of the video stream url.
* @param allowAudioStreamCopy Whether or not to allow copying of the audio stream url.
* @param breakOnNonKeyFrames Optional. Whether to break on non key frames.
* @param audioSampleRate Optional. Specify a specific audio sample rate, e.g. 44100.
* @param maxAudioBitDepth Optional. The maximum audio bit depth.
* @param audioBitRate Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.
* @param audioChannels Optional. Specify a specific number of audio channels to encode to, e.g. 2.
* @param maxAudioChannels Optional. Specify a maximum number of audio channels to encode to, e.g. 2.
* @param profile Optional. Specify a specific an encoder profile (varies by encoder), e.g. main, baseline, high.
* @param level Optional. Specify a level for the encoder profile (varies by encoder), e.g. 3, 3.1.
* @param framerate Optional. A specific video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param maxFramerate Optional. A specific maximum video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param copyTimestamps Whether or not to copy timestamps when transcoding with an offset. Defaults to false.
* @param startTimeTicks Optional. Specify a starting offset, in ticks. 1 tick &#x3D; 10000 ms.
* @param width Optional. The fixed horizontal resolution of the encoded video.
* @param height Optional. The fixed vertical resolution of the encoded video.
* @param videoBitRate Optional. Specify a video bitrate to encode to, e.g. 500000. If omitted this will be left to encoder defaults.
* @param subtitleStreamIndex Optional. The index of the subtitle stream to use. If omitted no subtitles will be used.
* @param subtitleMethod Optional. Specify the subtitle delivery method.
* @param maxRefFrames Optional.
* @param maxVideoBitDepth Optional. The maximum video bit depth.
* @param requireAvc Optional. Whether to require avc.
* @param deInterlace Optional. Whether to deinterlace the video.
* @param requireNonAnamorphic Optional. Whether to require a non anamorphic stream.
* @param transcodingMaxAudioChannels Optional. The maximum number of audio channels to transcode.
* @param cpuCoreLimit Optional. The limit of how many cpu cores to use.
* @param liveStreamId The live stream id.
* @param enableMpegtsM2TsMode Optional. Whether to enable the MpegtsM2Ts mode.
* @param videoCodec Optional. Specify a video codec to encode to, e.g. h264. If omitted the server will auto-select using the url\&#39;s extension. Options: h265, h264, mpeg4, theora, vp8, vp9, vpx (deprecated), wmv.
* @param subtitleCodec Optional. Specify a subtitle codec to encode to.
* @param transcodeReasons Optional. The transcoding reason.
* @param audioStreamIndex Optional. The index of the audio stream to use. If omitted the first audio stream will be used.
* @param videoStreamIndex Optional. The index of the video stream to use. If omitted the first video stream will be used.
* @param context Optional. The MediaBrowser.Model.Dlna.EncodingContext.
* @param streamOptions Optional. The streaming options.
*/
public async headAudioStream (itemId: string, container?: string, _static?: boolean, params?: string, tag?: string, deviceProfileId?: string, playSessionId?: string, segmentContainer?: string, segmentLength?: number, minSegments?: number, mediaSourceId?: string, deviceId?: string, audioCodec?: string, enableAutoStreamCopy?: boolean, allowVideoStreamCopy?: boolean, allowAudioStreamCopy?: boolean, breakOnNonKeyFrames?: boolean, audioSampleRate?: number, maxAudioBitDepth?: number, audioBitRate?: number, audioChannels?: number, maxAudioChannels?: number, profile?: string, level?: string, framerate?: number, maxFramerate?: number, copyTimestamps?: boolean, startTimeTicks?: number, width?: number, height?: number, videoBitRate?: number, subtitleStreamIndex?: number, subtitleMethod?: SubtitleDeliveryMethod, maxRefFrames?: number, maxVideoBitDepth?: number, requireAvc?: boolean, deInterlace?: boolean, requireNonAnamorphic?: boolean, transcodingMaxAudioChannels?: number, cpuCoreLimit?: number, liveStreamId?: string, enableMpegtsM2TsMode?: boolean, videoCodec?: string, subtitleCodec?: string, transcodeReasons?: string, audioStreamIndex?: number, videoStreamIndex?: number, context?: EncodingContext, streamOptions?: { [key: string]: string; }, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
const localVarPath = this.basePath + '/Audio/{itemId}/stream'
.replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['audio/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'itemId' is not null or undefined
if (itemId === null || itemId === undefined) {
throw new Error('Required parameter itemId was null or undefined when calling headAudioStream.');
}
if (container !== undefined) {
localVarQueryParameters['container'] = ObjectSerializer.serialize(container, "string");
}
if (_static !== undefined) {
localVarQueryParameters['static'] = ObjectSerializer.serialize(_static, "boolean");
}
if (params !== undefined) {
localVarQueryParameters['params'] = ObjectSerializer.serialize(params, "string");
}
if (tag !== undefined) {
localVarQueryParameters['tag'] = ObjectSerializer.serialize(tag, "string");
}
if (deviceProfileId !== undefined) {
localVarQueryParameters['deviceProfileId'] = ObjectSerializer.serialize(deviceProfileId, "string");
}
if (playSessionId !== undefined) {
localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string");
}
if (segmentContainer !== undefined) {
localVarQueryParameters['segmentContainer'] = ObjectSerializer.serialize(segmentContainer, "string");
}
if (segmentLength !== undefined) {
localVarQueryParameters['segmentLength'] = ObjectSerializer.serialize(segmentLength, "number");
}
if (minSegments !== undefined) {
localVarQueryParameters['minSegments'] = ObjectSerializer.serialize(minSegments, "number");
}
if (mediaSourceId !== undefined) {
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
}
if (deviceId !== undefined) {
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
}
if (audioCodec !== undefined) {
localVarQueryParameters['audioCodec'] = ObjectSerializer.serialize(audioCodec, "string");
}
if (enableAutoStreamCopy !== undefined) {
localVarQueryParameters['enableAutoStreamCopy'] = ObjectSerializer.serialize(enableAutoStreamCopy, "boolean");
}
if (allowVideoStreamCopy !== undefined) {
localVarQueryParameters['allowVideoStreamCopy'] = ObjectSerializer.serialize(allowVideoStreamCopy, "boolean");
}
if (allowAudioStreamCopy !== undefined) {
localVarQueryParameters['allowAudioStreamCopy'] = ObjectSerializer.serialize(allowAudioStreamCopy, "boolean");
}
if (breakOnNonKeyFrames !== undefined) {
localVarQueryParameters['breakOnNonKeyFrames'] = ObjectSerializer.serialize(breakOnNonKeyFrames, "boolean");
}
if (audioSampleRate !== undefined) {
localVarQueryParameters['audioSampleRate'] = ObjectSerializer.serialize(audioSampleRate, "number");
}
if (maxAudioBitDepth !== undefined) {
localVarQueryParameters['maxAudioBitDepth'] = ObjectSerializer.serialize(maxAudioBitDepth, "number");
}
if (audioBitRate !== undefined) {
localVarQueryParameters['audioBitRate'] = ObjectSerializer.serialize(audioBitRate, "number");
}
if (audioChannels !== undefined) {
localVarQueryParameters['audioChannels'] = ObjectSerializer.serialize(audioChannels, "number");
}
if (maxAudioChannels !== undefined) {
localVarQueryParameters['maxAudioChannels'] = ObjectSerializer.serialize(maxAudioChannels, "number");
}
if (profile !== undefined) {
localVarQueryParameters['profile'] = ObjectSerializer.serialize(profile, "string");
}
if (level !== undefined) {
localVarQueryParameters['level'] = ObjectSerializer.serialize(level, "string");
}
if (framerate !== undefined) {
localVarQueryParameters['framerate'] = ObjectSerializer.serialize(framerate, "number");
}
if (maxFramerate !== undefined) {
localVarQueryParameters['maxFramerate'] = ObjectSerializer.serialize(maxFramerate, "number");
}
if (copyTimestamps !== undefined) {
localVarQueryParameters['copyTimestamps'] = ObjectSerializer.serialize(copyTimestamps, "boolean");
}
if (startTimeTicks !== undefined) {
localVarQueryParameters['startTimeTicks'] = ObjectSerializer.serialize(startTimeTicks, "number");
}
if (width !== undefined) {
localVarQueryParameters['width'] = ObjectSerializer.serialize(width, "number");
}
if (height !== undefined) {
localVarQueryParameters['height'] = ObjectSerializer.serialize(height, "number");
}
if (videoBitRate !== undefined) {
localVarQueryParameters['videoBitRate'] = ObjectSerializer.serialize(videoBitRate, "number");
}
if (subtitleStreamIndex !== undefined) {
localVarQueryParameters['subtitleStreamIndex'] = ObjectSerializer.serialize(subtitleStreamIndex, "number");
}
if (subtitleMethod !== undefined) {
localVarQueryParameters['subtitleMethod'] = ObjectSerializer.serialize(subtitleMethod, "SubtitleDeliveryMethod");
}
if (maxRefFrames !== undefined) {
localVarQueryParameters['maxRefFrames'] = ObjectSerializer.serialize(maxRefFrames, "number");
}
if (maxVideoBitDepth !== undefined) {
localVarQueryParameters['maxVideoBitDepth'] = ObjectSerializer.serialize(maxVideoBitDepth, "number");
}
if (requireAvc !== undefined) {
localVarQueryParameters['requireAvc'] = ObjectSerializer.serialize(requireAvc, "boolean");
}
if (deInterlace !== undefined) {
localVarQueryParameters['deInterlace'] = ObjectSerializer.serialize(deInterlace, "boolean");
}
if (requireNonAnamorphic !== undefined) {
localVarQueryParameters['requireNonAnamorphic'] = ObjectSerializer.serialize(requireNonAnamorphic, "boolean");
}
if (transcodingMaxAudioChannels !== undefined) {
localVarQueryParameters['transcodingMaxAudioChannels'] = ObjectSerializer.serialize(transcodingMaxAudioChannels, "number");
}
if (cpuCoreLimit !== undefined) {
localVarQueryParameters['cpuCoreLimit'] = ObjectSerializer.serialize(cpuCoreLimit, "number");
}
if (liveStreamId !== undefined) {
localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string");
}
if (enableMpegtsM2TsMode !== undefined) {
localVarQueryParameters['enableMpegtsM2TsMode'] = ObjectSerializer.serialize(enableMpegtsM2TsMode, "boolean");
}
if (videoCodec !== undefined) {
localVarQueryParameters['videoCodec'] = ObjectSerializer.serialize(videoCodec, "string");
}
if (subtitleCodec !== undefined) {
localVarQueryParameters['subtitleCodec'] = ObjectSerializer.serialize(subtitleCodec, "string");
}
if (transcodeReasons !== undefined) {
localVarQueryParameters['transcodeReasons'] = ObjectSerializer.serialize(transcodeReasons, "string");
}
if (audioStreamIndex !== undefined) {
localVarQueryParameters['audioStreamIndex'] = ObjectSerializer.serialize(audioStreamIndex, "number");
}
if (videoStreamIndex !== undefined) {
localVarQueryParameters['videoStreamIndex'] = ObjectSerializer.serialize(videoStreamIndex, "number");
}
if (context !== undefined) {
localVarQueryParameters['context'] = ObjectSerializer.serialize(context, "EncodingContext");
}
if (streamOptions !== undefined) {
localVarQueryParameters['streamOptions'] = ObjectSerializer.serialize(streamOptions, "{ [key: string]: string; }");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'HEAD',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
encoding: null,
};
let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Buffer");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
*
* @summary Gets an audio stream.
* @param itemId The item id.
* @param container The audio container.
* @param _static Optional. If true, the original file will be streamed statically without any encoding. Use either no url extension or the original file extension. true/false.
* @param params The streaming parameters.
* @param tag The tag.
* @param deviceProfileId Optional. The dlna device profile id to utilize.
* @param playSessionId The play session id.
* @param segmentContainer The segment container.
* @param segmentLength The segment lenght.
* @param minSegments The minimum number of segments.
* @param mediaSourceId The media version id, if playing an alternate version.
* @param deviceId The device id of the client requesting. Used to stop encoding processes when needed.
* @param audioCodec Optional. Specify a audio codec to encode to, e.g. mp3. If omitted the server will auto-select using the url\&#39;s extension. Options: aac, mp3, vorbis, wma.
* @param enableAutoStreamCopy Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.
* @param allowVideoStreamCopy Whether or not to allow copying of the video stream url.
* @param allowAudioStreamCopy Whether or not to allow copying of the audio stream url.
* @param breakOnNonKeyFrames Optional. Whether to break on non key frames.
* @param audioSampleRate Optional. Specify a specific audio sample rate, e.g. 44100.
* @param maxAudioBitDepth Optional. The maximum audio bit depth.
* @param audioBitRate Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.
* @param audioChannels Optional. Specify a specific number of audio channels to encode to, e.g. 2.
* @param maxAudioChannels Optional. Specify a maximum number of audio channels to encode to, e.g. 2.
* @param profile Optional. Specify a specific an encoder profile (varies by encoder), e.g. main, baseline, high.
* @param level Optional. Specify a level for the encoder profile (varies by encoder), e.g. 3, 3.1.
* @param framerate Optional. A specific video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param maxFramerate Optional. A specific maximum video framerate to encode to, e.g. 23.976. Generally this should be omitted unless the device has specific requirements.
* @param copyTimestamps Whether or not to copy timestamps when transcoding with an offset. Defaults to false.
* @param startTimeTicks Optional. Specify a starting offset, in ticks. 1 tick &#x3D; 10000 ms.
* @param width Optional. The fixed horizontal resolution of the encoded video.
* @param height Optional. The fixed vertical resolution of the encoded video.
* @param videoBitRate Optional. Specify a video bitrate to encode to, e.g. 500000. If omitted this will be left to encoder defaults.
* @param subtitleStreamIndex Optional. The index of the subtitle stream to use. If omitted no subtitles will be used.
* @param subtitleMethod Optional. Specify the subtitle delivery method.
* @param maxRefFrames Optional.
* @param maxVideoBitDepth Optional. The maximum video bit depth.
* @param requireAvc Optional. Whether to require avc.
* @param deInterlace Optional. Whether to deinterlace the video.
* @param requireNonAnamorphic Optional. Whether to require a non anamporphic stream.
* @param transcodingMaxAudioChannels Optional. The maximum number of audio channels to transcode.
* @param cpuCoreLimit Optional. The limit of how many cpu cores to use.
* @param liveStreamId The live stream id.
* @param enableMpegtsM2TsMode Optional. Whether to enable the MpegtsM2Ts mode.
* @param videoCodec Optional. Specify a video codec to encode to, e.g. h264. If omitted the server will auto-select using the url\&#39;s extension. Options: h265, h264, mpeg4, theora, vp8, vp9, vpx (deprecated), wmv.
* @param subtitleCodec Optional. Specify a subtitle codec to encode to.
* @param transcodeReasons Optional. The transcoding reason.
* @param audioStreamIndex Optional. The index of the audio stream to use. If omitted the first audio stream will be used.
* @param videoStreamIndex Optional. The index of the video stream to use. If omitted the first video stream will be used.
* @param context Optional. The MediaBrowser.Model.Dlna.EncodingContext.
* @param streamOptions Optional. The streaming options.
*/
public async headAudioStreamByContainer (itemId: string, container: string, _static?: boolean, params?: string, tag?: string, deviceProfileId?: string, playSessionId?: string, segmentContainer?: string, segmentLength?: number, minSegments?: number, mediaSourceId?: string, deviceId?: string, audioCodec?: string, enableAutoStreamCopy?: boolean, allowVideoStreamCopy?: boolean, allowAudioStreamCopy?: boolean, breakOnNonKeyFrames?: boolean, audioSampleRate?: number, maxAudioBitDepth?: number, audioBitRate?: number, audioChannels?: number, maxAudioChannels?: number, profile?: string, level?: string, framerate?: number, maxFramerate?: number, copyTimestamps?: boolean, startTimeTicks?: number, width?: number, height?: number, videoBitRate?: number, subtitleStreamIndex?: number, subtitleMethod?: SubtitleDeliveryMethod, maxRefFrames?: number, maxVideoBitDepth?: number, requireAvc?: boolean, deInterlace?: boolean, requireNonAnamorphic?: boolean, transcodingMaxAudioChannels?: number, cpuCoreLimit?: number, liveStreamId?: string, enableMpegtsM2TsMode?: boolean, videoCodec?: string, subtitleCodec?: string, transcodeReasons?: string, audioStreamIndex?: number, videoStreamIndex?: number, context?: EncodingContext, streamOptions?: { [key: string]: string; }, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
const localVarPath = this.basePath + '/Audio/{itemId}/stream.{container}'
.replace('{' + 'itemId' + '}', encodeURIComponent(String(itemId)))
.replace('{' + 'container' + '}', encodeURIComponent(String(container)));
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
const produces = ['audio/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
} else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams: any = {};
// verify required parameter 'itemId' is not null or undefined
if (itemId === null || itemId === undefined) {
throw new Error('Required parameter itemId was null or undefined when calling headAudioStreamByContainer.');
}
// verify required parameter 'container' is not null or undefined
if (container === null || container === undefined) {
throw new Error('Required parameter container was null or undefined when calling headAudioStreamByContainer.');
}
if (_static !== undefined) {
localVarQueryParameters['static'] = ObjectSerializer.serialize(_static, "boolean");
}
if (params !== undefined) {
localVarQueryParameters['params'] = ObjectSerializer.serialize(params, "string");
}
if (tag !== undefined) {
localVarQueryParameters['tag'] = ObjectSerializer.serialize(tag, "string");
}
if (deviceProfileId !== undefined) {
localVarQueryParameters['deviceProfileId'] = ObjectSerializer.serialize(deviceProfileId, "string");
}
if (playSessionId !== undefined) {
localVarQueryParameters['playSessionId'] = ObjectSerializer.serialize(playSessionId, "string");
}
if (segmentContainer !== undefined) {
localVarQueryParameters['segmentContainer'] = ObjectSerializer.serialize(segmentContainer, "string");
}
if (segmentLength !== undefined) {
localVarQueryParameters['segmentLength'] = ObjectSerializer.serialize(segmentLength, "number");
}
if (minSegments !== undefined) {
localVarQueryParameters['minSegments'] = ObjectSerializer.serialize(minSegments, "number");
}
if (mediaSourceId !== undefined) {
localVarQueryParameters['mediaSourceId'] = ObjectSerializer.serialize(mediaSourceId, "string");
}
if (deviceId !== undefined) {
localVarQueryParameters['deviceId'] = ObjectSerializer.serialize(deviceId, "string");
}
if (audioCodec !== undefined) {
localVarQueryParameters['audioCodec'] = ObjectSerializer.serialize(audioCodec, "string");
}
if (enableAutoStreamCopy !== undefined) {
localVarQueryParameters['enableAutoStreamCopy'] = ObjectSerializer.serialize(enableAutoStreamCopy, "boolean");
}
if (allowVideoStreamCopy !== undefined) {
localVarQueryParameters['allowVideoStreamCopy'] = ObjectSerializer.serialize(allowVideoStreamCopy, "boolean");
}
if (allowAudioStreamCopy !== undefined) {
localVarQueryParameters['allowAudioStreamCopy'] = ObjectSerializer.serialize(allowAudioStreamCopy, "boolean");
}
if (breakOnNonKeyFrames !== undefined) {
localVarQueryParameters['breakOnNonKeyFrames'] = ObjectSerializer.serialize(breakOnNonKeyFrames, "boolean");
}
if (audioSampleRate !== undefined) {
localVarQueryParameters['audioSampleRate'] = ObjectSerializer.serialize(audioSampleRate, "number");
}
if (maxAudioBitDepth !== undefined) {
localVarQueryParameters['maxAudioBitDepth'] = ObjectSerializer.serialize(maxAudioBitDepth, "number");
}
if (audioBitRate !== undefined) {
localVarQueryParameters['audioBitRate'] = ObjectSerializer.serialize(audioBitRate, "number");
}
if (audioChannels !== undefined) {
localVarQueryParameters['audioChannels'] = ObjectSerializer.serialize(audioChannels, "number");
}
if (maxAudioChannels !== undefined) {
localVarQueryParameters['maxAudioChannels'] = ObjectSerializer.serialize(maxAudioChannels, "number");
}
if (profile !== undefined) {
localVarQueryParameters['profile'] = ObjectSerializer.serialize(profile, "string");
}
if (level !== undefined) {
localVarQueryParameters['level'] = ObjectSerializer.serialize(level, "string");
}
if (framerate !== undefined) {
localVarQueryParameters['framerate'] = ObjectSerializer.serialize(framerate, "number");
}
if (maxFramerate !== undefined) {
localVarQueryParameters['maxFramerate'] = ObjectSerializer.serialize(maxFramerate, "number");
}
if (copyTimestamps !== undefined) {
localVarQueryParameters['copyTimestamps'] = ObjectSerializer.serialize(copyTimestamps, "boolean");
}
if (startTimeTicks !== undefined) {
localVarQueryParameters['startTimeTicks'] = ObjectSerializer.serialize(startTimeTicks, "number");
}
if (width !== undefined) {
localVarQueryParameters['width'] = ObjectSerializer.serialize(width, "number");
}
if (height !== undefined) {
localVarQueryParameters['height'] = ObjectSerializer.serialize(height, "number");
}
if (videoBitRate !== undefined) {
localVarQueryParameters['videoBitRate'] = ObjectSerializer.serialize(videoBitRate, "number");
}
if (subtitleStreamIndex !== undefined) {
localVarQueryParameters['subtitleStreamIndex'] = ObjectSerializer.serialize(subtitleStreamIndex, "number");
}
if (subtitleMethod !== undefined) {
localVarQueryParameters['subtitleMethod'] = ObjectSerializer.serialize(subtitleMethod, "SubtitleDeliveryMethod");
}
if (maxRefFrames !== undefined) {
localVarQueryParameters['maxRefFrames'] = ObjectSerializer.serialize(maxRefFrames, "number");
}
if (maxVideoBitDepth !== undefined) {
localVarQueryParameters['maxVideoBitDepth'] = ObjectSerializer.serialize(maxVideoBitDepth, "number");
}
if (requireAvc !== undefined) {
localVarQueryParameters['requireAvc'] = ObjectSerializer.serialize(requireAvc, "boolean");
}
if (deInterlace !== undefined) {
localVarQueryParameters['deInterlace'] = ObjectSerializer.serialize(deInterlace, "boolean");
}
if (requireNonAnamorphic !== undefined) {
localVarQueryParameters['requireNonAnamorphic'] = ObjectSerializer.serialize(requireNonAnamorphic, "boolean");
}
if (transcodingMaxAudioChannels !== undefined) {
localVarQueryParameters['transcodingMaxAudioChannels'] = ObjectSerializer.serialize(transcodingMaxAudioChannels, "number");
}
if (cpuCoreLimit !== undefined) {
localVarQueryParameters['cpuCoreLimit'] = ObjectSerializer.serialize(cpuCoreLimit, "number");
}
if (liveStreamId !== undefined) {
localVarQueryParameters['liveStreamId'] = ObjectSerializer.serialize(liveStreamId, "string");
}
if (enableMpegtsM2TsMode !== undefined) {
localVarQueryParameters['enableMpegtsM2TsMode'] = ObjectSerializer.serialize(enableMpegtsM2TsMode, "boolean");
}
if (videoCodec !== undefined) {
localVarQueryParameters['videoCodec'] = ObjectSerializer.serialize(videoCodec, "string");
}
if (subtitleCodec !== undefined) {
localVarQueryParameters['subtitleCodec'] = ObjectSerializer.serialize(subtitleCodec, "string");
}
if (transcodeReasons !== undefined) {
localVarQueryParameters['transcodeReasons'] = ObjectSerializer.serialize(transcodeReasons, "string");
}
if (audioStreamIndex !== undefined) {
localVarQueryParameters['audioStreamIndex'] = ObjectSerializer.serialize(audioStreamIndex, "number");
}
if (videoStreamIndex !== undefined) {
localVarQueryParameters['videoStreamIndex'] = ObjectSerializer.serialize(videoStreamIndex, "number");
}
if (context !== undefined) {
localVarQueryParameters['context'] = ObjectSerializer.serialize(context, "EncodingContext");
}
if (streamOptions !== undefined) {
localVarQueryParameters['streamOptions'] = ObjectSerializer.serialize(streamOptions, "{ [key: string]: string; }");
}
(<any>Object).assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions: localVarRequest.Options = {
method: 'HEAD',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
encoding: null,
};
let authenticationPromise = Promise.resolve();
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = ObjectSerializer.deserialize(body, "Buffer");
resolve({ response: response, body: body });
} else {
reject(new HttpError(response, body, response.statusCode));
}
}
});
});
});
}
}