zby-live-sdk
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -5,2 +5,10 @@ # Change Log | ||
<a name="1.0.4"></a> | ||
## 1.0.4 (2018-11-22) | ||
1. 更新 .gitignore 文件 | ||
2. 更新 .npmignore 文件 | ||
3. 默认设备由默认第一个设备改为系统默认设备 | ||
4. rtc 以及 zego 底层 SDK 添加日志 | ||
<a name="1.0.3"></a> | ||
@@ -7,0 +15,0 @@ ## 1.0.3 (2018-11-20) |
{ | ||
"name": "zby-live-sdk", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/zby-live-sdk.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/zby-live-sdk.esm.js", |
@@ -9,2 +9,3 @@ /** | ||
import { getS, setS, compareS } from '../util/sessionStorage.js'; | ||
import ENTRY from '../channel/interactWithChannelEntry'; | ||
import util from '../util/util.js'; | ||
@@ -366,2 +367,3 @@ // 扩展标识 | ||
hasNetWrong = true; | ||
ENTRY.recordLogToFile('error', 'Network error'); | ||
rtcCallback({ | ||
@@ -431,2 +433,3 @@ type: 'network_error', | ||
hasNetWrong = true; | ||
ENTRY.recordLogToFile('error', 'Network error'); | ||
rtcCallback({ | ||
@@ -460,2 +463,3 @@ type: 'network_error', | ||
console.log('+++++++__________', '断网重推'); | ||
ENTRY.recordLogToFile('info', 'try to pushFlow again'); | ||
await stopPush(); | ||
@@ -475,2 +479,3 @@ await startPush(); | ||
console.log('+++++++__________', '断网重拉'); | ||
ENTRY.recordLogToFile('info', 'try to pullFlow again'); | ||
await stop(streamId); | ||
@@ -561,3 +566,4 @@ await play(streamId); | ||
deviceId: cameraListObject[cameraKeys[i]].deviceID, | ||
deviceName: cameraListObject[cameraKeys[i]].deviceName | ||
deviceName: cameraListObject[cameraKeys[i]].deviceName, | ||
isDefault: cameraListObject[cameraKeys[i]].bDefault | ||
}); | ||
@@ -598,3 +604,4 @@ } | ||
deviceId: speakerListObject[speakerKeys[i]].deviceID, | ||
deviceName: speakerListObject[speakerKeys[i]].deviceName | ||
deviceName: speakerListObject[speakerKeys[i]].deviceName, | ||
isDefault: speakerListObject[speakerKeys[i]].bDefault | ||
}); | ||
@@ -635,3 +642,4 @@ } | ||
deviceId: microphoneListObject[microphoneKeys[i]].deviceID, | ||
deviceName: microphoneListObject[microphoneKeys[i]].deviceName | ||
deviceName: microphoneListObject[microphoneKeys[i]].deviceName, | ||
isDefault: microphoneListObject[microphoneKeys[i]].bDefault | ||
}); | ||
@@ -1057,3 +1065,3 @@ } | ||
if (isLocal) { | ||
streamId = isInRoom ? (window.zbyAVSDK_init_params && window.zbyAVSDK_init_params.rtc.streamId) | ||
streamId = isInRoom ? (window.zbyAVSDK_init_params && window.zbyAVSDK_init_params.rtc.streamId) | ||
: 'deviceCheckerInit'; | ||
@@ -1172,3 +1180,13 @@ } | ||
if (cameraData.length) { | ||
await setCameraDevice(cameraData[0].deviceId); | ||
let hasSetCamera = false; | ||
for (let item of cameraData) { | ||
if (item.isDefault) { | ||
await setCameraDevice(item.deviceId); | ||
hasSetCamera = true; | ||
break; | ||
} | ||
} | ||
if (!hasSetCamera) { | ||
await setCameraDevice(cameraData[0].deviceId); | ||
} | ||
} | ||
@@ -1182,3 +1200,13 @@ } | ||
if (microPhoneData.length) { | ||
await setMicrophoneDevice(microPhoneData[0].deviceId); | ||
let hasSetMicrophone = false; | ||
for (let item of microPhoneData) { | ||
if (item.isDefault) { | ||
await setMicrophoneDevice(item.deviceId); | ||
hasSetMicrophone = true; | ||
break; | ||
} | ||
} | ||
if (!hasSetMicrophone) { | ||
await setMicrophoneDevice(microPhoneData[0].deviceId); | ||
} | ||
} | ||
@@ -1192,3 +1220,13 @@ } | ||
if (speakerData.length) { | ||
await setSpeakerDevice(speakerData[0].deviceId); | ||
let hasSetSpeaker = false; | ||
for (let item of speakerData) { | ||
if (item.isDefault) { | ||
await setSpeakerDevice(item.deviceId); | ||
hasSetSpeaker = true; | ||
break; | ||
} | ||
} | ||
if (!hasSetSpeaker) { | ||
await setSpeakerDevice(speakerData[0].deviceId); | ||
} | ||
} | ||
@@ -1195,0 +1233,0 @@ } |
@@ -9,2 +9,3 @@ /** | ||
import { getS, setS, compareS } from '../util/sessionStorage.js'; | ||
import ENTRY from '../channel/interactWithChannelEntry'; | ||
// 扩展标识 | ||
@@ -179,2 +180,3 @@ const extensionId = 'zego_ext'; | ||
hasNetWrong = true; | ||
ENTRY.recordLogToFile('error', 'Network error'); | ||
zegoCallback({ | ||
@@ -198,2 +200,3 @@ type: 'network_error', | ||
hasNetWrong = true; | ||
ENTRY.recordLogToFile('error', 'Network error'); | ||
zegoCallback({ | ||
@@ -305,2 +308,3 @@ type: 'network_error', | ||
console.log('+++++++__________', '断网重推'); | ||
ENTRY.recordLogToFile('info', 'try to pushFlow again'); | ||
await stopPublish(); | ||
@@ -320,2 +324,3 @@ await startPublish2(); | ||
console.log('+++++++__________', '断网重拉'); | ||
ENTRY.recordLogToFile('info', 'try to pullFlow again'); | ||
await stopPlayStream(streamId); | ||
@@ -399,2 +404,32 @@ await playStream(streamId); | ||
/** | ||
* @function 获取系统默认的音频设备 | ||
* @param deviceType:Number 音频设备类型,0 -> 麦克风,1 -> 扬声器,必选 | ||
* @return Promise | void | ||
*/ | ||
export const getDefaultAudioDeviceId = (deviceType) => { | ||
return callMethod('GetDefaultAudioDeviceId', { | ||
deviceType, | ||
// 以下两个参数仅仅是为了向下向后兼容,使用 hardcore 即可 | ||
deviceId: '', | ||
deviceIdLength: 0 | ||
}); | ||
}; | ||
/** | ||
* @function 获取系统默认的麦克风设备 id | ||
* @return Promise | ||
*/ | ||
export const getDefaultMicrophone = () => { | ||
return getDefaultAudioDeviceId(0); | ||
} | ||
/** | ||
* @function 获取系统默认的扬声器设备 id | ||
* @return Promise | ||
*/ | ||
export const getDefaultSpeaker = () => { | ||
return getDefaultAudioDeviceId(1); | ||
} | ||
/** | ||
* @function 获取摄像头列表 | ||
@@ -412,3 +447,4 @@ * @return Promise | void | ||
deviceId: videoListArr[i].szDeviceId, | ||
deviceName: videoListArr[i].szDeviceName | ||
deviceName: videoListArr[i].szDeviceName, | ||
isDefault: i === 0 | ||
}); | ||
@@ -547,2 +583,3 @@ } | ||
export const getSpeakerDeviceList = async () => { | ||
const defaultSpeakerId = JSON.parse((await getDefaultSpeaker()).msg).ret.deviceId; | ||
let speakerListArr = JSON.parse((await getAudioDeviceList(1)).msg).ret; | ||
@@ -553,3 +590,4 @@ let speakerList = []; | ||
deviceId: speakerListArr[i].szDeviceId, | ||
deviceName: speakerListArr[i].szDeviceName | ||
deviceName: speakerListArr[i].szDeviceName, | ||
isDefault: defaultSpeakerId === speakerListArr[i].szDeviceId | ||
}); | ||
@@ -625,2 +663,3 @@ } | ||
export const getMicrophoneDeviceList = async () => { | ||
const defaultMicrophoneId = JSON.parse((await getDefaultMicrophone()).msg).ret.deviceId; | ||
let microphoneListArr = JSON.parse((await getAudioDeviceList(0)).msg).ret; | ||
@@ -631,3 +670,4 @@ let microphoneList = []; | ||
deviceId: microphoneListArr[i].szDeviceId, | ||
deviceName: microphoneListArr[i].szDeviceName | ||
deviceName: microphoneListArr[i].szDeviceName, | ||
isDefault: defaultMicrophoneId === microphoneListArr[i].szDeviceId | ||
}); | ||
@@ -1016,3 +1056,13 @@ } | ||
if (cameraData.length) { | ||
await setVideoDevice(cameraData[0].deviceId); | ||
let hasSetCamera = false; | ||
for (let item of cameraData) { | ||
if (item.isDefault) { | ||
await setVideoDevice(item.deviceId); | ||
hasSetCamera = true; | ||
break; | ||
} | ||
} | ||
if (!hasSetCamera) { | ||
await setVideoDevice(cameraData[0].deviceId); | ||
} | ||
} | ||
@@ -1029,3 +1079,13 @@ } | ||
if (microPhoneData.length) { | ||
await setMicrophoneDevice(microPhoneData[0].deviceId); | ||
let hasSetMicrophone = false; | ||
for (let item of microPhoneData) { | ||
if (item.isDefault) { | ||
await setMicrophoneDevice(item.deviceId); | ||
hasSetMicrophone = true; | ||
break; | ||
} | ||
} | ||
if (!hasSetMicrophone) { | ||
await setMicrophoneDevice(microPhoneData[0].deviceId); | ||
} | ||
} | ||
@@ -1039,3 +1099,13 @@ } | ||
if (speakerData.length) { | ||
await setSpeakerDevice(speakerData[0].deviceId); | ||
let hasSetSpeaker = false; | ||
for (let item of speakerData) { | ||
if (item.isDefault) { | ||
await setSpeakerDevice(item.deviceId); | ||
hasSetSpeaker = true; | ||
break; | ||
} | ||
} | ||
if (!hasSetSpeaker) { | ||
await setSpeakerDevice(speakerData[0].deviceId); | ||
} | ||
} | ||
@@ -1042,0 +1112,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1552513
46496
1
28