Skip to content

Commit

Permalink
feat:MusicContentCenter (#904)
Browse files Browse the repository at this point in the history
* refactor: adapt native

* refactor: recovery impl

* feat: musiccontentcenter

Co-authored-by: luz <[email protected]>
  • Loading branch information
player0x3 and luz authored Oct 18, 2022
1 parent 7cd100b commit aedd92d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ts/Private/IAgoraRtcEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import { LogConfig, LogFilterType, LogLevel } from './IAgoraLog';
import { IMediaPlayer } from './IAgoraMediaPlayer';
import { AudioMixingDualMonoMode, IMediaEngine } from './IAgoraMediaEngine';
import { IAudioDeviceManager } from './IAudioDeviceManager';
import { IMusicContentCenter } from './IAgoraMusicContentCenter';
import { IMediaRecorder } from './IAgoraMediaRecorder';
import { ILocalSpatialAudioEngine } from './IAgoraSpatialAudio';
/**
Expand Down Expand Up @@ -5696,6 +5697,11 @@ export abstract class IRtcEngine {
*/
abstract getVideoDeviceManager(): IVideoDeviceManager;

/**
* @ignore
*/
abstract getMusicContentCenter(): IMusicContentCenter;

/**
* Gets one IMediaEngine object.
* Make sure the IRtcEngine is initialized before you call this method.
Expand Down
1 change: 1 addition & 0 deletions ts/Private/extension/IAgoraMusicContentCenterExtension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
12 changes: 12 additions & 0 deletions ts/Private/impl/IAgoraRtcEngineImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import { AudioMixingDualMonoMode, IMediaEngine } from '../IAgoraMediaEngine';
import { LogFilterType, LogLevel } from '../IAgoraLog';
import { AgoraRhythmPlayerConfig } from '../IAgoraRhythmPlayer';
import { IAudioDeviceManager } from '../IAudioDeviceManager';
import { IMusicContentCenter } from '../IAgoraMusicContentCenter';
import { IMediaRecorder } from '../IAgoraMediaRecorder';
import { ILocalSpatialAudioEngine } from '../IAgoraSpatialAudio';
export function processIRtcEngineEventHandler(
Expand Down Expand Up @@ -6524,6 +6525,17 @@ export class IRtcEngineImpl implements IRtcEngine {
return 'RtcEngine_getVideoDeviceManager';
}

getMusicContentCenter(): IMusicContentCenter {
const apiType = this.getApiTypeFromGetMusicContentCenter();
const jsonParams = {};
const jsonResults = callIrisApi.call(this, apiType, jsonParams);
return jsonResults.result;
}

protected getApiTypeFromGetMusicContentCenter(): string {
return 'RtcEngine_getMusicContentCenter';
}

getMediaEngine(): IMediaEngine {
const apiType = this.getApiTypeFromGetMediaEngine();
const jsonParams = {};
Expand Down
15 changes: 11 additions & 4 deletions ts/Private/internal/RtcEngineExInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { IAudioSpectrumObserver } from '../AgoraMediaBase';
import { IMediaEngine } from '../IAgoraMediaEngine';
import { IMediaPlayer } from '../IAgoraMediaPlayer';
import { IMediaRecorder } from '../IAgoraMediaRecorder';
import { IMusicContentCenter } from '../IAgoraMusicContentCenter';
import {
ChannelMediaOptions,
DirectCdnStreamingMediaOptions,
Expand All @@ -33,7 +34,7 @@ import {
ScreenCaptureSourceInfo,
SDKBuildInfo,
Size,
ExtensionInfo
ExtensionInfo,
} from '../IAgoraRtcEngine';
import { RtcConnection } from '../IAgoraRtcEngineEx';
import { IAudioDeviceManager } from '../IAudioDeviceManager';
Expand All @@ -51,6 +52,7 @@ import { MediaRecorderInternal } from './MediaRecorderInternal';
import { ILocalSpatialAudioEngine } from '../IAgoraSpatialAudio';
import { LocalSpatialAudioEngineInternal } from './LocalSpatialAudioEngineInternal';
import { IAudioDeviceManagerImpl } from '../impl/IAudioDeviceManagerImpl';
import { IMusicContentCenterImpl } from '../impl/IAgoraMusicContentCenterImpl';
import {
processIDirectCdnStreamingEventHandler,
processIMetadataObserver,
Expand All @@ -76,6 +78,8 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
new IVideoDeviceManagerImpl();
private _media_engine: IMediaEngine = new MediaEngineInternal();
private _media_recorder: IMediaRecorder = new MediaRecorderInternal();
private _music_content_center: IMusicContentCenter =
new IMusicContentCenterImpl();
private _local_spatial_audio_engine: ILocalSpatialAudioEngine =
new LocalSpatialAudioEngineInternal();
private _events: Map<
Expand Down Expand Up @@ -335,8 +339,8 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
streamConfig?: SimulcastStreamConfig
): string {
return streamConfig === undefined
?'RtcEngine_setDualStreamMode'
:'RtcEngine_setDualStreamMode2';
? 'RtcEngine_setDualStreamMode'
: 'RtcEngine_setDualStreamMode2';
}

protected getApiTypeFromLeaveChannelEx(
Expand Down Expand Up @@ -365,7 +369,6 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
return 'RtcEngine_enableExtension2';
}


protected getApiTypeFromSetExtensionProperty(
provider: string,
extension: string,
Expand Down Expand Up @@ -421,6 +424,10 @@ export class RtcEngineExInternal extends IRtcEngineExImpl {
return this._media_recorder;
}

getMusicContentCenter(): IMusicContentCenter {
return this._music_content_center;
}

getLocalSpatialAudioEngine(): ILocalSpatialAudioEngine {
return this._local_spatial_audio_engine;
}
Expand Down

0 comments on commit aedd92d

Please sign in to comment.