Skip to content

Commit

Permalink
release/4.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
yydounai1234 committed Jul 15, 2022
1 parent fb1b972 commit 7be4ff6
Show file tree
Hide file tree
Showing 8 changed files with 512 additions and 11,532 deletions.
936 changes: 468 additions & 468 deletions Demo/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "multiple-track-demo",
"version": "4.1.4",
"version": "4.1.5",
"private": true,
"description": "multiple track demo",
"author": "Yao Zhi <[email protected]>",
Expand Down Expand Up @@ -33,7 +33,7 @@
"mobx": "^5.8.0",
"mobx-react": "^5.4.3",
"mobx-react-router": "^4.0.5",
"qnweb-rtc": "^4.1.4",
"qnweb-rtc": "^4.1.5",
"qs": "^6.6.0",
"react": "^16.8.0",
"react-app-polyfill": "^0.2.0",
Expand Down
3 changes: 2 additions & 1 deletion Demo/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
Expand All @@ -21,6 +21,7 @@
-->
<title>七牛 RTN Web Demo</title>
</head>
<script src="./qnplayer.js"></script>
<body>
<noscript>
You need to enable JavaScript to run this app.
Expand Down
2 changes: 2 additions & 0 deletions Demo/public/qnplayer.js

Large diffs are not rendered by default.

27 changes: 23 additions & 4 deletions Demo/src/components/MergeConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
QNRenderMode,
QNDirectLiveStreamingConfig,
QNTranscodingLiveStreamingImage,
QNTrack,
} from "qnweb-rtc";
import {
Drawer,
Expand All @@ -25,6 +26,7 @@ import {
} from "@material-ui/core";
import { RoomStore } from "../../stores/roomStore";
import { MessageStore } from "../../stores/messageStore";
import Track from "../../models/Track";

const styles = (theme: Theme) =>
createStyles({
Expand Down Expand Up @@ -131,6 +133,22 @@ const MergeConfig = (props: MergeConfigProp) => {
// 合流状态 - 0未创建 1已创建 2编辑中
const [jobStatus, setJobStatus] = useState(0);

/**
* 获取单路转推第一个音/视频轨道没有返回undfined
* @param publishedTracks 发布的音/视频轨道
* @returns QNTrack | undefined
*/
const getFirstRtcTrack = (publishedTracks: Track[]): QNTrack | undefined => {
let rtcTrack;
if (publishedTracks.length > 0) {
const firstTrack = publishedTracks[0];
if (firstTrack) {
rtcTrack = firstTrack.rtcTrack;
}
}
return rtcTrack;
};

// 开启单路转推
const startDirectLiveStreaming = () => {
if (roomStore.session && roomStore.session.userID !== "admin") {
Expand All @@ -140,11 +158,12 @@ const MergeConfig = (props: MergeConfigProp) => {
title: "没有权限",
content: '只有"admin"用户可以开启单路转推!!!',
});
return false;
return;
}
const config: QNDirectLiveStreamingConfig = {
videoTrack: roomStore.publishedCameraTracks[0].rtcTrack,
audioTrack: roomStore.publishedAudioTracks[0].rtcTrack,
//fix: PILCS-10497 牛会议demo,纯音频、屏幕共享+系统声音不可使用单路转推
videoTrack: getFirstRtcTrack(roomStore.publishedCameraTracks),
audioTrack: getFirstRtcTrack(roomStore.publishedAudioTracks),
streamID: `demo${roomStore.id}`,
url: `rtmp://pili-publish.qnsdk.com/sdk-live/${roomStore.id}`,
};
Expand Down Expand Up @@ -303,7 +322,7 @@ const MergeConfig = (props: MergeConfigProp) => {
title: "没有权限",
content: '只有"admin"用户可以开启单路转推!!!',
});
return false;
return;
}
setTranscodingLiveModel(true);
};
Expand Down
Loading

0 comments on commit 7be4ff6

Please sign in to comment.