1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1638, #307, refactor rtc player.

This commit is contained in:
winlin 2020-03-18 10:03:20 +08:00
parent e2233027b8
commit c210c0b2f5
2 changed files with 7 additions and 4 deletions

View file

@ -53,6 +53,7 @@
</footer>
</div>
<script type="text/javascript">
var pc = null; // Global handler to do cleanup when replaying.
$(function(){
$('#rtc_media_player').hide();
var query = parse_query_string();
@ -63,7 +64,12 @@
var urlObject = parse_rtmp_url($("#txt_url").val());
var schame = window.location.protocol;
var pc = new RTCPeerConnection(null);
// Close PC when user replay.
if (pc) {
pc.close();
}
pc = new RTCPeerConnection(null);
pc.onaddstream = function (event) {
var player = document.getElementById('rtc_media_player');
player.srcObject = event.stream;