如何解决Opentok Publisher.publishVideo函数在移动设备上的离子Cordova应用程序上不起作用
我创建了一个离子应用程序,其中我正在使用opentok api进行视频通话。一切正常。我使用Publisher.publishVideo()函数实现了打开和关闭摄像头的功能,与我使用Publisher.publishAudio()实现麦克风的静音和取消静音功能的方法相同。
问题是publishAudio()工作正常。但publishVideo()可在网络上使用,而不能在android和ios等其他平台上使用。
这是一些代码段
我的HTML:
<ion-col
size="1.5"
style="background-color: rgb(48,47,47); text-align: right;"
>
<fa-icon
*ngIf="Video"
(click)="EnabledisableVideo()"
[icon]="['fas','video']"
style="font-size: 30px;"
[styles]="{'stroke': 'white','color': 'white'}"
></fa-icon>
<fa-icon
*ngIf="!Video"
(click)="EnabledisableVideo()"
[icon]="['fas','video-slash']"
style="font-size: 30px;"
[styles]="{'stroke': 'white','color': 'white'}"
></fa-icon>
</ion-col>
<ion-col
size="1.5"
style="background-color: rgb(48,47); text-align: right;"
>
<fa-icon
*ngIf="Micr"
(click)="EnabledisableAudio()"
[icon]="['fas','microphone-alt']"
style="font-size: 30px;"
[styles]="{'stroke': 'white','color': 'white'}"
></fa-icon>
<fa-icon
*ngIf="!Micr"
(click)="EnabledisableAudio()"
[icon]="['fas','microphone-alt-slash']"
style="font-size: 30px;"
[styles]="{'stroke': 'white','color': 'white'}"
></fa-icon>
</ion-col>
我的JavaScript功能禁用音频和视频:
import { QuickNotesPage } from "../quick-notes/quick-notes.page";
import {
ModalController,NavParams,ActionSheetController,AlertController,NavController,Platform,Events,} from "@ionic/angular";
import { ServicePrescriptionPage } from "../service-prescription/service-prescription.page";
import { EPrescriptionPage } from "../eprescription/eprescription.page";
import { TelemedicineTipsPage } from "../telemedicine-tips/telemedicine-tips.page";
import { ActivatedRoute,Router } from "@angular/router";
import { Component,OnInit,ViewChild,ngzone } from "@angular/core";
import { IonContent } from "@ionic/angular";
import { ActionPage } from "../action/action.page";
import { Telemedicineservice } from "../telemedicine.service";
import { IdleService } from "src/app/services/idle.service";
declare var OT: any;
@Component({
selector: "app-video-call",templateUrl: "./video-call.page.html",styleUrls: ["./video-call.page.scss"],})
export class VideoCallPage implements OnInit {
@ViewChild("content") private content: any;
session: any;
subscriber: any;
publisher: any;
apiKey: any;
sessionId: string;
token: string;
UserType;
Msgs = [];
Msg;
Telemedicine_Request_ID;
Call = true;
Video = true;
Micr = true;
attach: string;
action: any;
setting;
data;
cTime;
countDownTime = 0;
distance = 0;
minutes1 = 0;
minutes;
seconds1 = 0;
seconds;
interval = undefined;
File1;
formData;
AlertMsg;
title = "SIMPLYMEDBOOKING";
inBounds = true;
edge = {
top: true,bottom: true,left: true,right: true,};
bothJoin = false;
UserData: any;
EndSession = false;
SessionDetail;
//before both join
countDownTime_before = 0;
distance_before = 0;
minutes1_before = 0;
minutes_before;
seconds1_before = 0;
seconds_before;
interval_before = undefined;
cTime_before: Date;
disconnected: boolean;
AttachmentMsg;
backbutton: any;
constructor(
public events: Events,public zone: ngzone,public platform: Platform,public navCtrl: NavController,public Telemedicine: Telemedicineservice,public alertController: AlertController,public actionSheetController: ActionSheetController,public modalController: ModalController,public router: Router,public idle: IdleService
) {
this.idle.GetUserToken();
this.UserType = this.router.getCurrentNavigation().extras.state.UserType;
this.Telemedicine_Request_ID = this.router.getCurrentNavigation().extras.state.Telemedicine_Request_ID;
if (this.UserType == 4) {
this.AlertMsg =
"Please wait 5 minutes for the patient to join the call,if the patient doesn't join with in 5 minutes then session will be considered as No Show.";
} else {
this.AlertMsg =
"Please wait 5 minutes for the doctor to join the call,if the doctor doesn't join with in 5 minutes then session will be considered as missed.";
}
this.Telemedicine.getUserAndDoctorInfoByUID().subscribe(
(result) => {
this.UserData = result;
},(err) => {
console.log(err);
this.Telemedicine.isLoading = false;
this.Telemedicine.loadingController.dismiss();
this.Telemedicine.ErrorAlert();
},() => {
this.Telemedicine.isLoading = false;
this.Telemedicine.loadingController.dismiss();
}
);
} // constructor ends here
EnabledisableAudio() {
this.Micr = !this.Micr;
if (this.Micr) {
this.publisher.publishAudio(true);
} else {
this.publisher.publishAudio(false);
}
}
EnabledisableVideo() {
this.Video = !this.Video;
if (this.Video) {
this.publisher.publishVideo(true);
} else {
this.publisher.publishVideo(false);
}
}
}
请帮助我。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。