Skip to content

Commit

Permalink
fix resolution bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shellGrace committed May 25, 2020
1 parent 8e397c8 commit e5fd2be
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
52 changes: 39 additions & 13 deletions TroubleShooting/Agora-WebRTC-Troubleshooting/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,18 @@
<v-dialog v-model="dialog" persistent max-width="360">
<v-card>
<v-card-title>
<v-tabs v-model="currentProfile">
<v-tabs>
<v-tab
v-for="(item, index) in ProfileForTry"
@click="retry"
:disabled="trying"
@click="retry(index)"
:key="index"
>
{{item}}
{{item.resolution}}
</v-tab>
</v-tabs>
</v-card-title>
<v-card-text>
<div v-if="!showVideo">{{text.videoText}}</div>
<div id="modal-video" v-if="!errMsgForTry">

</div>
Expand Down Expand Up @@ -333,8 +333,8 @@ export default {
browserInfo: navigator.appVersion || "Current Browser",
language: navigator.language.match(/^zh/) ? 0 : 1,
sdkVersion: AgoraRtc.VERSION,
trying: false,
snackbar: false,
showVideo: false,
dialog: false,
currentTestSuite: "-1",
inputVolume: 0,
Expand Down Expand Up @@ -397,7 +397,20 @@ export default {
]
},
errMsgForTry: "",
ProfileForTry: ["480p_1", "720p_1", "1080p_1"],
ProfileForTry: [
{
resolution: "480p_1",
isSuccess: false
},
{
resolution: "720p_1",
isSuccess: false
},
{
resolution: "1080p_1",
isSuccess: false
},
],
currentProfile: 0
};
},
Expand Down Expand Up @@ -619,7 +632,7 @@ export default {
audio: true,
screen: false
});
this.sendStream.setVideoProfile(profile.enum);
this.sendStream.setVideoProfile(profile.resolution);
this.sendStream.init(
() => {
this.sendStream.play("test-send");
Expand Down Expand Up @@ -870,30 +883,43 @@ export default {
haveATry() {
this.snackbar = false;
this.dialog = true;
this.retry();
this.ProfileForTry.forEach((item) => {
let index = this.profiles.findIndex((profile) => {
return profile.resolution === item.resolution
})
if(index === -1) {
return
}
item.isSuccess = this.profiles[index].status === 'resolve'
})
this.retry(0);
},
retry() {
this.trying = true;
retry(currentIndex) {
if (this.sendStream) {
this.sendStream.stop();
this.sendStream.close();
}
//If the resolution is equal to not supported, 1. Do not play video stream; 2. Give error prompt
if (this.ProfileForTry[currentIndex].isSuccess) {
this.showVideo = true
} else {
this.showVideo = false
return
}
this.sendStream = AgoraRtc.createStream({
streamID: this.sendId,
video: true,
audio: true,
screen: false
});
this.sendStream.setVideoProfile(this.ProfileForTry[this.currentProfile]);
this.sendStream.setVideoProfile(this.ProfileForTry[currentIndex].resolution);
this.sendStream.init(
() => {
this.sendStream.play("modal-video");
this.trying = false;
},
err => {
this.errMsgForTry = err.msg;
this.trying = false;
}
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ export default {
'packet_loss': 'Packet Loss',
'Video_Packet_Loss': 'Video Packet Loss',
'Audio_Packet_Loss': 'Audio Packet Loss',
'some_functions_may_be_limited': 'Some functions may be limited'
'some_functions_may_be_limited': 'Some functions may be limited',
'videoText': 'The device does not support the current resolution'
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ export default {
'Video_Packet_Loss': '视频包丢失',
'Audio_Packet_Loss': '音频包丢失',
'some_functions_may_be_limited': '有些功能受限',
'videoText': '设备不支持当前分辨率',
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const profileArray = [
{enum: '120p', width: 160, height: 120},
{enum: '180p', width: 320, height: 180},
{enum: '240P', width: 320, height: 240},
{enum: '360p', width: 640, height: 360},
{enum: '480p', width: 640, height: 480},
{enum: '720p', width: 1280, height: 720},
{enum: '1080p', width: 1920, height: 1080}
{resolution: '120p_1', width: 160, height: 120},
{resolution: '180p_1', width: 320, height: 180},
{resolution: '240P_1', width: 320, height: 240},
{resolution: '360p_1', width: 640, height: 360},
{resolution: '480p_1', width: 640, height: 480},
{resolution: '720p_1', width: 1280, height: 720},
{resolution: '1080p_1', width: 1920, height: 1080}
]

export const APP_ID = '' // input your app id here
export const APP_ID = '316e30dceffa43729142b04333a8094a' // input your app id here

0 comments on commit e5fd2be

Please sign in to comment.