@100mslive/hms-video-store
Advanced tools
Comparing version 0.12.13-alpha.0 to 0.12.13-alpha.1
import { HMSConnectionRole } from './model'; | ||
import { HMSAudioTrackSettings, HMSVideoTrackSettings } from '../media/settings'; | ||
import { HMSLocalTrack } from '../media/tracks'; | ||
@@ -39,3 +40,3 @@ import { TrackState } from '../notification-manager'; | ||
removeTrack(sender: RTCRtpSender): void; | ||
setMaxBitrateAndFramerate(track: HMSLocalTrack): Promise<void>; | ||
setMaxBitrateAndFramerate(track: HMSLocalTrack, updatedSettings?: HMSAudioTrackSettings | HMSVideoTrackSettings): Promise<void>; | ||
getStats(): Promise<RTCStatsReport>; | ||
@@ -42,0 +43,0 @@ close(): Promise<void>; |
@@ -19,2 +19,6 @@ export declare enum HMSVideoCodec { | ||
} | ||
export declare enum HMSAudioMode { | ||
VOICE = "voice", | ||
MUSIC = "music" | ||
} | ||
export interface HMSAudioTrackSettings { | ||
@@ -26,2 +30,3 @@ volume?: number; | ||
advanced?: Array<MediaTrackConstraintSet>; | ||
audioMode?: HMSAudioMode; | ||
} | ||
@@ -28,0 +33,0 @@ export interface HMSVideoTrackSettings { |
import { IAnalyticsPropertiesProvider } from '../../analytics/IAnalyticsPropertiesProvider'; | ||
import { HMSAudioCodec, HMSAudioTrackSettings as IHMSAudioTrackSettings } from '../../interfaces'; | ||
import { HMSAudioCodec, HMSAudioMode, HMSAudioTrackSettings as IHMSAudioTrackSettings } from '../../interfaces'; | ||
export declare class HMSAudioTrackSettingsBuilder { | ||
@@ -8,2 +8,3 @@ private _volume; | ||
private _deviceId; | ||
private _audioMode; | ||
private _advanced; | ||
@@ -14,2 +15,3 @@ volume(volume: number): this; | ||
deviceId(deviceId: string): this; | ||
audioMode(mode?: HMSAudioMode): this; | ||
advanced(advanced: Array<MediaTrackConstraintSet>): this; | ||
@@ -24,3 +26,4 @@ build(): HMSAudioTrackSettings; | ||
readonly advanced?: Array<MediaTrackConstraintSet>; | ||
constructor(volume?: number, codec?: HMSAudioCodec, maxBitrate?: number, deviceId?: string, advanced?: Array<MediaTrackConstraintSet>); | ||
readonly audioMode?: HMSAudioMode; | ||
constructor(volume?: number, codec?: HMSAudioCodec, maxBitrate?: number, deviceId?: string, advanced?: Array<MediaTrackConstraintSet>, audioMode?: HMSAudioMode); | ||
toConstraints(): MediaTrackConstraints; | ||
@@ -27,0 +30,0 @@ toAnalyticsProperties(): { |
import { HMSMediaStream } from './HMSMediaStream'; | ||
import HMSPublishConnection from '../../connection/publish/publishConnection'; | ||
import { SimulcastLayer } from '../../interfaces'; | ||
import { HMSAudioTrackSettings, HMSVideoTrackSettings } from '../settings'; | ||
import { HMSLocalTrack } from '../tracks'; | ||
@@ -11,3 +12,3 @@ export declare class HMSLocalStream extends HMSMediaStream { | ||
addTransceiver(track: HMSLocalTrack, simulcastLayers: SimulcastLayer[]): RTCRtpTransceiver; | ||
setMaxBitrateAndFramerate(track: HMSLocalTrack): Promise<void>; | ||
setMaxBitrateAndFramerate(track: HMSLocalTrack, updatedSettings?: HMSAudioTrackSettings | HMSVideoTrackSettings): Promise<void>; | ||
setPreferredCodec(_transceiver: RTCRtpTransceiver, _kind: string): void; | ||
@@ -14,0 +15,0 @@ replaceStreamTrack(track: MediaStreamTrack, withTrack: MediaStreamTrack): void; |
{ | ||
"version": "0.12.13-alpha.0", | ||
"version": "0.12.13-alpha.1", | ||
"license": "MIT", | ||
@@ -76,3 +76,3 @@ "repository": { | ||
], | ||
"gitHead": "82f45fd8c79f9b264094447217d533d395e831fd" | ||
"gitHead": "bb6605c7147547550e46be6a5108dae4efe81eb8" | ||
} |
import { HMSConnectionRole } from './model'; | ||
import { ErrorFactory } from '../error/ErrorFactory'; | ||
import { HMSAction } from '../error/HMSAction'; | ||
import { HMSAudioTrackSettings, HMSVideoTrackSettings } from '../media/settings'; | ||
import { HMSLocalTrack, HMSLocalVideoTrack } from '../media/tracks'; | ||
@@ -165,4 +166,8 @@ import { TrackState } from '../notification-manager'; | ||
async setMaxBitrateAndFramerate(track: HMSLocalTrack) { | ||
const maxBitrate = track.settings.maxBitrate; | ||
// eslint-disable-next-line | ||
async setMaxBitrateAndFramerate( | ||
track: HMSLocalTrack, | ||
updatedSettings?: HMSAudioTrackSettings | HMSVideoTrackSettings, | ||
) { | ||
const maxBitrate = updatedSettings?.maxBitrate || track.settings.maxBitrate; | ||
const maxFramerate = track instanceof HMSLocalVideoTrack && track.settings.maxFramerate; | ||
@@ -169,0 +174,0 @@ const sender = this.getSenders().find(s => s?.track?.id === track.getTrackIDBeingSent()); |
@@ -329,2 +329,3 @@ import { DeviceStorageManager } from './DeviceStorage'; | ||
.deviceId(newSelection.deviceId) | ||
.audioMode(settings.audioMode) | ||
.build(); | ||
@@ -331,0 +332,0 @@ try { |
@@ -22,2 +22,7 @@ export enum HMSVideoCodec { | ||
export enum HMSAudioMode { | ||
VOICE = 'voice', | ||
MUSIC = 'music', | ||
} | ||
export interface HMSAudioTrackSettings { | ||
@@ -29,2 +34,3 @@ volume?: number; | ||
advanced?: Array<MediaTrackConstraintSet>; | ||
audioMode?: HMSAudioMode; | ||
} | ||
@@ -31,0 +37,0 @@ |
import { IAnalyticsPropertiesProvider } from '../../analytics/IAnalyticsPropertiesProvider'; | ||
import { HMSAudioCodec, HMSAudioTrackSettings as IHMSAudioTrackSettings } from '../../interfaces'; | ||
import { HMSAudioCodec, HMSAudioMode, HMSAudioTrackSettings as IHMSAudioTrackSettings } from '../../interfaces'; | ||
@@ -9,2 +9,3 @@ export class HMSAudioTrackSettingsBuilder { | ||
private _deviceId = 'default'; | ||
private _audioMode: HMSAudioMode = HMSAudioMode.VOICE; | ||
private _advanced: Array<MediaTrackConstraintSet> = [ | ||
@@ -42,3 +43,3 @@ // @ts-ignore | ||
} | ||
this._maxBitrate = maxBitrate; | ||
this._maxBitrate = this._audioMode === HMSAudioMode.MUSIC ? 320 : maxBitrate; | ||
return this; | ||
@@ -53,2 +54,10 @@ } | ||
audioMode(mode: HMSAudioMode = HMSAudioMode.VOICE) { | ||
this._audioMode = mode; | ||
if (this._audioMode === HMSAudioMode.MUSIC) { | ||
this._maxBitrate = 320; | ||
} | ||
return this; | ||
} | ||
advanced(advanced: Array<MediaTrackConstraintSet>) { | ||
@@ -60,3 +69,10 @@ this._advanced = advanced; | ||
build() { | ||
return new HMSAudioTrackSettings(this._volume, this._codec, this._maxBitrate, this._deviceId, this._advanced); | ||
return new HMSAudioTrackSettings( | ||
this._volume, | ||
this._codec, | ||
this._maxBitrate, | ||
this._deviceId, | ||
this._advanced, | ||
this._audioMode, | ||
); | ||
} | ||
@@ -71,2 +87,3 @@ } | ||
readonly advanced?: Array<MediaTrackConstraintSet>; | ||
readonly audioMode?: HMSAudioMode; | ||
@@ -79,2 +96,3 @@ constructor( | ||
advanced?: Array<MediaTrackConstraintSet>, | ||
audioMode?: HMSAudioMode, | ||
) { | ||
@@ -86,2 +104,6 @@ this.volume = volume; | ||
this.advanced = advanced; | ||
this.audioMode = audioMode; | ||
if (this.audioMode === HMSAudioMode.MUSIC) { | ||
this.maxBitrate = 320; | ||
} | ||
} | ||
@@ -92,3 +114,3 @@ | ||
deviceId: this.deviceId, | ||
advanced: this.advanced, | ||
advanced: this.audioMode === HMSAudioMode.MUSIC ? [] : this.advanced, | ||
}; | ||
@@ -95,0 +117,0 @@ } |
@@ -6,2 +6,3 @@ import { HMSMediaStream } from './HMSMediaStream'; | ||
import { isNode } from '../../utils/support'; | ||
import { HMSAudioTrackSettings, HMSVideoTrackSettings } from '../settings'; | ||
import { HMSLocalTrack, HMSLocalVideoTrack } from '../tracks'; | ||
@@ -29,4 +30,7 @@ | ||
async setMaxBitrateAndFramerate(track: HMSLocalTrack): Promise<void> { | ||
await this.connection?.setMaxBitrateAndFramerate(track); | ||
async setMaxBitrateAndFramerate( | ||
track: HMSLocalTrack, | ||
updatedSettings?: HMSAudioTrackSettings | HMSVideoTrackSettings, | ||
): Promise<void> { | ||
await this.connection?.setMaxBitrateAndFramerate(track, updatedSettings); | ||
} | ||
@@ -33,0 +37,0 @@ |
@@ -19,3 +19,3 @@ import isEqual from 'lodash.isequal'; | ||
function generateHasPropertyChanged(newSettings: Partial<HMSAudioTrackSettings>, oldSettings: HMSAudioTrackSettings) { | ||
return function hasChanged(prop: 'codec' | 'volume' | 'maxBitrate' | 'deviceId' | 'advanced') { | ||
return function hasChanged(prop: 'codec' | 'volume' | 'maxBitrate' | 'deviceId' | 'advanced' | 'audioMode') { | ||
return !isEqual(newSettings[prop], oldSettings[prop]); | ||
@@ -253,4 +253,4 @@ }; | ||
private buildNewSettings(settings: Partial<HMSAudioTrackSettings>) { | ||
const { volume, codec, maxBitrate, deviceId, advanced } = { ...this.settings, ...settings }; | ||
const newSettings = new HMSAudioTrackSettings(volume, codec, maxBitrate, deviceId, advanced); | ||
const { volume, codec, maxBitrate, deviceId, advanced, audioMode } = { ...this.settings, ...settings }; | ||
const newSettings = new HMSAudioTrackSettings(volume, codec, maxBitrate, deviceId, advanced, audioMode); | ||
return newSettings; | ||
@@ -262,7 +262,7 @@ } | ||
const hasPropertyChanged = generateHasPropertyChanged(settings, this.settings); | ||
if (hasPropertyChanged('maxBitrate') && settings.maxBitrate) { | ||
await stream.setMaxBitrateAndFramerate(this); | ||
if ((hasPropertyChanged('maxBitrate') || hasPropertyChanged('audioMode')) && settings.maxBitrate) { | ||
await stream.setMaxBitrateAndFramerate(this, settings); | ||
} | ||
if (hasPropertyChanged('advanced')) { | ||
if (hasPropertyChanged('advanced') || hasPropertyChanged('audioMode')) { | ||
await this.replaceTrackWith(settings); | ||
@@ -269,0 +269,0 @@ } |
@@ -221,3 +221,2 @@ import { HMSAction } from '../../error/HMSAction'; | ||
private convertHls(hlsNotification?: HLSNotification) { | ||
// only checking for zeroth variant intialized | ||
const isInitialised = | ||
@@ -224,0 +223,0 @@ hlsNotification?.variants && hlsNotification.variants.length > 0 |
@@ -362,2 +362,3 @@ import { PEER_NOTIFICATION_TYPES, POLL_NOTIFICATION_TYPES, TRACK_NOTIFICATION_TYPES } from './common/mapping'; | ||
const trackID = this.store.getState(selectLocalAudioTrackID); | ||
if (trackID) { | ||
@@ -364,0 +365,0 @@ await this.setSDKLocalAudioTrackSettings(trackID, settings); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4494006
38700