简体   繁体   中英

iOS webrtc app using cordova-plugin-iosrtc: video element issues

I'm developing an hybrid app for iOS using ionic/cordova. This app implements some typical webrtc features such as video calls and file transfers between two peers. For this purpose I'm using cordova-plugin-iosrtc which exposes all W3C WebRTC APIs.

While RTCPeerConnection, getUserMedia and other Javascript WebRTC APIs implementations are pretty good, otherwise the video element to which streams are attached is substituted by a native UIView layer (see Usage ).

This way you can't completely control via JS the pseudo-video element (that is UIView ). For example it's not possible to resize the video, position it, change all its CSS properties and so on. UIView size and position are set at initial value of HTML video element.

Is there a workaround or an alternative to this limitation (opened as an issue ) of iosrtc cordova plugin?

Yes, the video element is not an actual HTML DOM element displays the video, however the library mimics the CSS of the video element to the best of its ability (for dimensions and positioning).

You can still manipulate the video element using JavaScript, but you must call an iosrtc method to update the UIView afterwards Using:

iosrtc.refreshVideos()

More information can be found here: https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/docs/iosrtc.md#iosrtcrefreshvideos

cordova plugin iosrtc is updated and fixed the issue according to https://github.com/eface2face/cordova-plugin-iosrtc/pull/179 .

Update the plugin and it will solve the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM