I did investigated a bit further, the troubles do not seem to disappear regarding to the autoplay functionalities. Both devices having camera/ microphone permissions and 1 device is streaming audio only (the subscriber) while the publisher is streaming audio and video. According to the docs “If a user access its camera or microphone, then there’s no need of user gestures at all (as soon as they accept camera permissions, remote videos will automatically start playing).”, so that is the case.
Also, when the subscriber changes his wifi to 4g or back the remote stream starts playing. The same happens when the publisher changes his front cam to the back or the other way around, with a result that the subscriber sees the video.
A side note is that it is not happening always, just sometimes. So it seems like a timing issue. I have also added all the autoplay/ muted capabilities and touch actions to play the video, but that is as described earlier not the problem.
— UPDATE —
It is also not working reliability in the OpenVidu-ionic-capacitor project. In this case I publish with audio and video:
const publisher: Publisher = this.OV.initPublisher(undefined, {
audioSource: undefined, // The source of audio. If undefined default microphone
videoSource: undefined, // The source of video. If undefined default webcam
publishAudio: true, // Whether you want to start publishing with your audio unmuted or not
publishVideo: true, // Whether you want to start publishing with your video enabled or not
resolution: '640x480', // The resolution of your video
frameRate: 30, // The frame rate of your video
insertMode: 'APPEND', // How the video is inserted in the target element 'video-container'
mirror: true // Whether to mirror your local video or not
});
Where I subscribe without audio:
this.session.on('streamCreated', (event: StreamEvent) => {
// Subscribe to the Stream to receive it. Second parameter is undefined
// so OpenVidu doesn't create an HTML video on its own
const properties = {
subscribeToAudio: false
};
const subscriber: Subscriber = this.session.subscribe(event.stream, undefined, properties);
this.subscribers.push(subscriber);
});
With above code the incoming video stream at the subscriber is black (most of the times). I have also added a button to the view and a video html element as described in the docs:
<ion-fab vertical="bottom" horizontal="center" slot="fixed">
<ion-fab-button size="small" color="danger" (click)="leaveSession()">
<ion-icon name="power"></ion-icon>
</ion-fab-button>
<ion-fab-button size="small" color="danger" (click)="toggle()">
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab>
</ion-content>
<video id="hidden-video"></video>
</ion-app>
Where this is the toggle implementation:
toggle() {
let audioPlayer = <HTMLVideoElement> document.getElementById("hidden-video");
audioPlayer.play();
this.refreshVideos();
}
Even with the above code the stream is not appearing (just black), and also here, the stream appears when I toggle the wifi/ 4g. So can it be another issue?