Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support 4.2.0 #995

Merged
merged 75 commits into from
May 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
b22ddcc
build: optimize
LichKing-2234 Apr 3, 2023
1db0306
build: update iris to 4.2.0-dev.1
LichKing-2234 Apr 3, 2023
b0c8ffa
build: update iris to 4.2.0-dev.1
LichKing-2234 Apr 3, 2023
1c8cf34
build: update iris to 4.2.0-dev.1
LichKing-2234 Apr 3, 2023
6d0ea53
ci: optimize
LichKing-2234 Apr 3, 2023
9c62272
Merge branch 'main' into dev/4.2.0
LichKing-2234 Apr 3, 2023
a37bae2
[AUTO] Generate code by terra (#967)
LichKing-2234 Apr 3, 2023
514bafc
[AUTO] Generate code by terra (#972)
LichKing-2234 Apr 6, 2023
b81f589
ci: optimize
LichKing-2234 Apr 6, 2023
2ae081b
[AUTO] Generate code by terra (#973)
LichKing-2234 Apr 6, 2023
230e6c2
[AUTO] Generate code by terra (#974)
LichKing-2234 Apr 7, 2023
4304e4c
chore: optimize
LichKing-2234 Apr 7, 2023
8cae5cc
chore: optimize
LichKing-2234 Apr 10, 2023
8f5b7a7
chore: optimize
LichKing-2234 Apr 10, 2023
0d7e043
chore: optimize
LichKing-2234 Apr 12, 2023
661840e
fix: `removeSubscription` not a function
LichKing-2234 Apr 12, 2023
a806482
fix: ProcessVideoRawData not working
LichKing-2234 Apr 12, 2023
882dcf6
chore: optimize examples
LichKing-2234 Apr 13, 2023
9a90af5
chore: optimize examples
LichKing-2234 Apr 13, 2023
6ccbcff
Update package.json
LichKing-2234 Apr 13, 2023
bdcb715
Update eslint-plugin-auto-import+0.1.1.patch
LichKing-2234 Apr 13, 2023
f660939
[AUTO] Generate code by terra (#980)
LichKing-2234 Apr 13, 2023
4b9ba27
chore: optimize examples
LichKing-2234 Apr 14, 2023
8d6a5d4
chore: optimize examples
LichKing-2234 Apr 14, 2023
17e0c4b
chore: optimize examples
LichKing-2234 Apr 14, 2023
4db41e3
[AUTO] Generate code by terra (#982)
LichKing-2234 Apr 17, 2023
5f8b567
chore: optimize examples
LichKing-2234 Apr 18, 2023
44af24f
chore: optimize examples
LichKing-2234 Apr 18, 2023
14bbce6
fix: jira NMS-12422 NMS-12418
LichKing-2234 Apr 18, 2023
48ead15
build: optimize buildJS.js
LichKing-2234 Apr 18, 2023
5b1f0bf
chore: optimize example
LichKing-2234 Apr 18, 2023
8239e09
chore: optimize example
LichKing-2234 Apr 19, 2023
52fbc0a
chore: optimize example
LichKing-2234 Apr 19, 2023
1ce0727
chore: optimize example
LichKing-2234 Apr 19, 2023
71d0262
chore: optimize example
LichKing-2234 Apr 20, 2023
89c2651
feat: support main process
LichKing-2234 Apr 20, 2023
0e6ce64
chore: optimize
LichKing-2234 Apr 21, 2023
1cda85a
chore: optimize
LichKing-2234 May 10, 2023
e8157ce
fix: `removeListener` not working with same callback
LichKing-2234 May 11, 2023
8dd78dd
chore: optimize
LichKing-2234 May 15, 2023
39e4365
chore: optimize
LichKing-2234 May 15, 2023
9ccd3a2
chore: optimize
LichKing-2234 May 15, 2023
3951780
[AUTO] Generate comments by iris-doc (#1001)
LichKing-2234 May 17, 2023
25a10ef
chore: optimize
LichKing-2234 May 18, 2023
f9a3a1a
build: add jest
LichKing-2234 May 19, 2023
99994f9
chore: optimize
LichKing-2234 May 19, 2023
6c84d61
chore: optimize
LichKing-2234 May 19, 2023
ed9f428
chore: optimize
LichKing-2234 May 19, 2023
b8932ed
chore: optimize
LichKing-2234 May 19, 2023
025d68c
[AUTO] Generate code by terra (#1005)
LichKing-2234 May 19, 2023
d7915d1
[AUTO] Generate comments by iris-doc (#1010)
LichKing-2234 May 23, 2023
5d50666
chore: optimize
LichKing-2234 May 23, 2023
fc230b4
[WIP] optimize
LichKing-2234 May 23, 2023
1d3f45a
fix: NMS-13120
LichKing-2234 May 23, 2023
9c5098b
chore: fix `AgoraDropdown` onValueChange type
LichKing-2234 May 23, 2023
a39e6c1
chore: use `startCameraCapture` instead of `startPreview` in LocalVid…
LichKing-2234 May 23, 2023
d7db2d1
ci: optimize build.yml
LichKing-2234 May 24, 2023
16400a0
ci: optimize publish
LichKing-2234 May 24, 2023
0763f2c
ci: optimize publish
LichKing-2234 May 24, 2023
2dab7f6
ci: optimize
LichKing-2234 May 24, 2023
9ecbfed
ci: fix
LichKing-2234 May 24, 2023
70783f1
ci: fix
LichKing-2234 May 24, 2023
29e0e13
ci: fix publish
LichKing-2234 May 24, 2023
b69cd03
ci: fix publish
LichKing-2234 May 24, 2023
e665905
ci: fix publish
LichKing-2234 May 24, 2023
aa49e32
ci: fix publish
LichKing-2234 May 24, 2023
22e67de
ci: fix publish
LichKing-2234 May 24, 2023
b2775a9
ci: fix build
LichKing-2234 May 24, 2023
80e5564
ci: fix publish
LichKing-2234 May 24, 2023
82a24f2
ci: fix build
LichKing-2234 May 24, 2023
9c2ef43
fix: NMS-13148 GetVideoFrameCache crash while setMetadata
LichKing-2234 May 25, 2023
a965996
fix: NMS-13149 removeAllListener issue
LichKing-2234 May 25, 2023
d22ce0b
chore: optimize
LichKing-2234 May 25, 2023
5e1ac16
ci: optimize
LichKing-2234 May 25, 2023
a049fba
chore: update iris 4.2.0-build.3
LichKing-2234 May 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: optimize examples
  • Loading branch information
LichKing-2234 committed Apr 18, 2023
commit 5f8b567400b2cafa9cb10bc7fead0afa5fcc14e8
3 changes: 3 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@
"dependencies": {
"agora-electron-sdk": "4.2.0-dev.5",
"antd": "^4.20.3",
"download": "^8.0.0",
"ffi-napi": "^4.0.3",
"history": "^5.0.0",
"react": "^18.1.0",
@@ -82,7 +83,9 @@
"@electron/rebuild": "^3.2.10",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.6",
"@teamsupercell/typings-for-css-modules-loader": "^2.5.1",
"@types/download": "^8.0.2",
"@types/react": "^16.9.44",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^18.0.3",
"@types/react-router-dom": "^5.1.6",
"electron": "18.2.3",
90 changes: 36 additions & 54 deletions example/src/renderer/App.tsx
Original file line number Diff line number Diff line change
@@ -11,10 +11,13 @@ import {
} from 'react-router-dom';

import './App.global.scss';
import advanceRoute from './examples/advanced';
import basicRoute from './examples/basic';

import Advanced from './examples/advanced';
import Basic from './examples/basic';
import AuthInfoScreen from './examples/config/AuthInfoScreen';
import hooksRoutes from './examples/hook';
import Hooks from './examples/hook';

const DATA = [Basic, Advanced, Hooks];

const { Content, Footer, Sider } = Layout;
const { SubMenu } = Menu;
@@ -30,7 +33,7 @@ class App extends React.Component {
this.setState({ version: engine.getVersion() });
}

onCollapse = (collapsed) => {
onCollapse = (collapsed: any) => {
console.log(collapsed);
this.setState({ collapsed });
};
@@ -46,62 +49,41 @@ class App extends React.Component {
<Menu.Item key="1" icon={<SettingOutlined />}>
<Link to="/">Setting</Link>
</Menu.Item>
<SubMenu key="sub1" icon={<GithubOutlined />} title="Basic">
{basicRoute.map(({ path, title }, index) => {
console.log('path, title ', path, title);
return (
<Menu.Item key={`${index} ${title}`}>
<Link to={path}>{title}</Link>
</Menu.Item>
);
})}
</SubMenu>
<SubMenu key="sub3" icon={<GithubOutlined />} title="Advanced">
{advanceRoute.map(({ path, title }, index) => {
return (
<Menu.Item key={`${index} ${title}`}>
<Link to={path}>{title}</Link>
</Menu.Item>
);
})}
</SubMenu>
<SubMenu key="sub2" icon={<GithubOutlined />} title="Hooks">
{hooksRoutes.map(({ path, title }, index) => {
console.log('path, title---> ', path, title);
return (
<Menu.Item key={`${index} ${title}`}>
<Link to={path}>{title}</Link>
</Menu.Item>
);
})}
</SubMenu>
{DATA.map((value, index) => {
return (
<SubMenu
key={`sub${index}`}
icon={<GithubOutlined />}
title={value.title}
>
{value.data.map(({ name }) => {
return (
<Menu.Item key={name}>
<Link to={`/${name}`}>{name}</Link>
</Menu.Item>
);
})}
</SubMenu>
);
})}
</Menu>
</Sider>
<Layout className="site-layout">
<Content style={{ flex: 1 }}>
<Switch>
<Route path="/" children={<AuthInfoScreen />} exact={true} />
{basicRoute.map((route: any, index) => (
<Route
key={`${index}`}
path={route.path}
children={<route.component />}
/>
))}
{advanceRoute.map((route: any, index) => (
<Route
key={`${index}`}
path={route.path}
children={<route.component />}
/>
))}
{hooksRoutes.map((route: any, index) => (
<Route
key={`${index}`}
path={route.path}
children={<route.component />}
/>
))}
{DATA.map((value) => {
return value.data.map(({ name, component }) => {
const RouteComponent = component;
return (
<Route
key={name}
path={`/${name}`}
children={<RouteComponent />}
/>
);
});
})}
<Route path="*">
<Redirect to="/" />
</Route>
10 changes: 6 additions & 4 deletions example/src/renderer/components/BaseComponent.tsx
Original file line number Diff line number Diff line change
@@ -136,18 +136,19 @@ export abstract class BaseComponent<
}

render() {
const users = this.renderUsers();
const configuration = this.renderConfiguration();
return (
<AgoraView className={AgoraStyle.screen}>
<AgoraView className={AgoraStyle.content}>
{this.renderUsers()}
{users ? this.renderUsers() : undefined}
</AgoraView>
<AgoraView className={AgoraStyle.rightBar}>
{this.renderChannel()}
{configuration ? (
<>
<AgoraDivider>
The Configuration of {this.constructor.name}
{`The Configuration of ${this.constructor.name}`}
</AgoraDivider>
{configuration}
</>
@@ -184,9 +185,10 @@ export abstract class BaseComponent<
const { startPreview, joinChannelSuccess, remoteUsers } = this.state;
return (
<>
{startPreview || joinChannelSuccess ? (
{!!startPreview || joinChannelSuccess ? this.renderVideo(0) : undefined}
{!!startPreview || joinChannelSuccess ? (
<AgoraList
data={[0, ...(remoteUsers ?? [])]}
data={remoteUsers ?? []}
renderItem={(item) => {
return this.renderVideo(item);
}}
6 changes: 3 additions & 3 deletions example/src/renderer/components/RtcSurfaceView/index.tsx
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import {
VideoSourceType,
createAgoraRtcEngine,
} from 'agora-electron-sdk';
import { Component } from 'react';
import React, { Component } from 'react';

import { getRandomInt } from '../../utils';

@@ -24,11 +24,11 @@ interface State {
}

class RtcSurfaceView extends Component<Props, State> {
constructor(props) {
constructor(props: Props) {
super(props);
this.state = {
isMirror:
props.mirrorMode === VideoMirrorModeType.VideoMirrorModeDisabled,
props.canvas.mirrorMode === VideoMirrorModeType.VideoMirrorModeDisabled,
uniqueId: getRandomInt(),
};
}
16 changes: 8 additions & 8 deletions example/src/renderer/components/ui/index.tsx
Original file line number Diff line number Diff line change
@@ -264,31 +264,31 @@ export const AgoraDropdown = (
}))}
selectedKeys={
_value?.map
? _value.map((v) => v.toString())
? _value.map((v: any) => v.toString())
: [_value?.toString()]
}
onSelect={(info) => {
let key;
let key: any;
if (typeof _value === 'number') {
key = +info.key;
} else {
key = info.key;
}
const index = _items?.findIndex(({ value }) => {
return value === key;
return value == key;
});
setValue(key);
props.onValueChange?.call(this, key, index ?? -1);
}}
onDeselect={(info) => {
let key;
let key: any;
if (typeof _value === 'number') {
key = +info.key;
} else {
key = info.key;
}
const index = _items?.findIndex(({ value }) => {
return value === key;
return value == key;
});
setValue(key);
props.onValueChange?.call(this, key, index ?? -1);
@@ -300,14 +300,14 @@ export const AgoraDropdown = (
{_value?.map
? _value
?.map(
(v) =>
(v: any) =>
_items?.find((item) => {
return v === item.value;
return v == item.value;
})?.label
)
?.toString()
: _items?.find((item) => {
return _value === item.value;
return _value == item.value;
})?.label}
<DownOutlined />
</Button>
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ export default class LocalVideoTranscoder
clientRoleType: ClientRoleType.ClientRoleBroadcaster,
publishMicrophoneTrack: false,
publishCameraTrack: false,
publishTrancodedVideoTrack: true,
publishTranscodedVideoTrack: true,
});
}

@@ -154,13 +154,21 @@ export default class LocalVideoTranscoder
};

startCameraCapture = (deviceId: string) => {
const type = this._getVideoSourceTypeCamera(deviceId);
this.engine?.startCameraCapture(type, { deviceId });
const sourceType = this._getVideoSourceTypeCamera(deviceId);
if (sourceType === undefined) {
this.error('sourceType is invalid');
return;
}
this.engine?.startCameraCapture(sourceType, { deviceId });
};

stopCameraCapture = (deviceId: string) => {
const type = this._getVideoSourceTypeCamera(deviceId);
this.engine?.stopScreenCapture(type);
const sourceType = this._getVideoSourceTypeCamera(deviceId);
if (sourceType === undefined) {
this.error('sourceType is invalid');
return;
}
this.engine?.stopScreenCaptureBySourceType(sourceType);
};

/**
@@ -187,7 +195,7 @@ export default class LocalVideoTranscoder
this.error(`targetSource is invalid`);
}

this.engine?.startScreenCaptureDesktop(
this.engine?.startScreenCaptureBySourceType(
VideoSourceType.VideoSourceScreenPrimary,
{
isCaptureWindow:
@@ -216,7 +224,9 @@ export default class LocalVideoTranscoder
* Step 3-4 (Optional): stopScreenCapture
*/
stopScreenCapture = () => {
this.engine?.stopScreenCapture(VideoSourceType.VideoSourceScreenPrimary);
this.engine?.stopScreenCaptureBySourceType(
VideoSourceType.VideoSourceScreenPrimary
);
this.setState({ startScreenCapture: false });
};

@@ -312,14 +322,15 @@ export default class LocalVideoTranscoder
}

if (imageUrl) {
const getImageType = (url) => {
const getImageType = (url: string): VideoSourceType | undefined => {
if (url.endsWith('.png')) {
return VideoSourceType.VideoSourceRtcImagePng;
} else if (url.endsWith('.jepg') || url.endsWith('.jpg')) {
return VideoSourceType.VideoSourceRtcImageJpeg;
} else if (url.endsWith('.gif')) {
return VideoSourceType.VideoSourceRtcImageGif;
}
return undefined;
};
streams.push({
sourceType: getImageType(imageUrl),
Original file line number Diff line number Diff line change
@@ -490,19 +490,15 @@ export default class MusicContentCenter

protected renderUsers(): React.ReactNode {
const { musics, songCode } = this.state;
return (
<>
{songCode >= 0 ? (
<AgoraImage
source={
musics.find((value) => {
return value.songCode === songCode;
})?.poster
}
/>
) : undefined}
</>
);
return +songCode >= 0 ? (
<AgoraImage
source={
musics.find((value) => {
return value.songCode == songCode;
})?.poster
}
/>
) : undefined;
}

protected renderAction(): React.ReactNode {
Original file line number Diff line number Diff line change
@@ -579,7 +579,7 @@ export default class ScreenShare
<AgoraDivider />
<SketchPicker
onChangeComplete={(color) => {
const { a, r, g, b } = color.rgb;
const { a = 1, r, g, b } = color.rgb;
const argbHex =
`${((a * 255) | (1 << 8)).toString(16).slice(1)}` +
`${(r | (1 << 8)).toString(16).slice(1)}` +
Loading