Closed mgara closed 1 year ago
@mgara Hi. You can use this event.
const player = OvenPlayer.create('player', {
sources: [
{
type: 'webrtc',
file: 'xxx'
},
]
});
player.on('peerConnectionPrepared', function (myPeerConnection) {
setInterval(() => {
myPeerConnection.getStats(null).then((stats) => {
let statsOutput = "";
stats.forEach((report) => {
statsOutput +=
`<h2>Report: ${report.type}</h2>\n<strong>ID:</strong> ${report.id}<br>\n` +
`<strong>Timestamp:</strong> ${report.timestamp}<br>\n`;
Object.keys(report).forEach((statName) => {
if (
statName !== "id" &&
statName !== "timestamp" &&
statName !== "type"
) {
statsOutput += `<strong>${statName}:</strong> ${report[statName]}<br>\n`;
}
});
});
document.querySelector(".stats-box").innerHTML = statsOutput;
});
}, 1000);
});
player.on('peerConnectionDestroyed', function (pc) {
console.log('PeerConnection has been destroyed >A<')
});
Thanks @SangwonOh appreciate your answer, tested and worked !
I want to display the fps on the video, is there a way to do that knowing that the functionality exists if the
RTCPeerConnection
is exposed as follows :