0
當暫停視頻時,最後一幀顯示在元素中,我如何清除該元素,以便清除該幀,並顯示元素的初始背景樣式?用戶是否可以設置Html視頻元素的背景?
當暫停視頻時,最後一幀顯示在元素中,我如何清除該元素,以便清除該幀,並顯示元素的初始背景樣式?用戶是否可以設置Html視頻元素的背景?
我通過查看示例代碼得到了答案。關鍵是通過connection.close()來停止傳輸,所以沒有新的blob會來自發送者,並且將接收者的視頻的src設置爲空字符串。
var connection = new RTCPeerConnection({ iceServers: _iceServers });
...
// Close the connection between myself and the given partner
_closeConnection = function() {
if (_connection) {
_onStreamRemovedCallback(null, null);
// Close the connection
_connection.close();
}
},
onStreamRemoved: function (connection, streamId) {
// todo: proper stream removal. right now we are only set up for one-on-one which is why this works.
console.log('removing remote stream from partner window');
// Clear out the partner window
var otherVideo = document.querySelector('.video.partner');
otherVideo.src = '';
}
var vid = document.getElementById("myVideo");
vid.onpause = function() {
// change background color of element or add overlay to the element
};