mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
c210c0b2f5
commit
979d7c3f4f
1 changed files with 15 additions and 9 deletions
|
@ -45,7 +45,7 @@
|
|||
</div>
|
||||
|
||||
<label></label>
|
||||
<video id="rtc_media_player" autoplay controls></video>
|
||||
<video id="rtc_media_player" controls autoplay></video>
|
||||
|
||||
<footer>
|
||||
<p></p>
|
||||
|
@ -55,11 +55,7 @@
|
|||
<script type="text/javascript">
|
||||
var pc = null; // Global handler to do cleanup when replaying.
|
||||
$(function(){
|
||||
$('#rtc_media_player').hide();
|
||||
var query = parse_query_string();
|
||||
srs_init_rtc("#txt_url", query);
|
||||
|
||||
$("#btn_play").click(function(){
|
||||
var startPlay = function() {
|
||||
$('#rtc_media_player').show();
|
||||
var urlObject = parse_rtmp_url($("#txt_url").val());
|
||||
var schame = window.location.protocol;
|
||||
|
@ -71,8 +67,7 @@
|
|||
|
||||
pc = new RTCPeerConnection(null);
|
||||
pc.onaddstream = function (event) {
|
||||
var player = document.getElementById('rtc_media_player');
|
||||
player.srcObject = event.stream;
|
||||
$('#rtc_media_player').prop('srcObject', event.stream);
|
||||
};
|
||||
new Promise(function(resolve, reject) {
|
||||
pc.createOffer(function(offer){
|
||||
|
@ -125,7 +120,18 @@
|
|||
}).catch(function(reason) {
|
||||
throw reason;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$('#rtc_media_player').hide();
|
||||
var query = parse_query_string();
|
||||
srs_init_rtc("#txt_url", query);
|
||||
|
||||
$("#btn_play").click(startPlay);
|
||||
if (query.autostart === 'true') {
|
||||
// For autostart, we should mute it, see https://www.jianshu.com/p/c3c6944eed5a
|
||||
$('#rtc_media_player').prop('muted', true);
|
||||
startPlay();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue