Switch/Close stream

Issues when playing live broadcasts with Unreal HTML5 MSE player on a web page

Switch/Close stream

Postby mirek » Thu Jan 04, 2018 11:37 am

Hello,
I am creating web page with possibility of switch video stream.
Running
RunPlayer("UnrealPlayer1", 640, 360, "77.x.y.174", 5119, false, "anotherName", "", true, true, 1, "", false);
works well, but as I can see in Unreal Media Server Configuration utility, the previously played stream is not closed.
All stream are closed after leaving the page.
Is there any function to close the stream?
Thank you very much
Mirek
mirek
 
Posts: 0
Joined: Thu Jan 04, 2018 11:28 am

Re: Switch/Close stream

Postby admin » Thu Jan 04, 2018 2:39 pm

Regarding your question about secure websockets (HTTPS):
viewtopic.php?f=28&t=3489

Now to this question:
"I am creating web page with possibility of switch video stream" - what do you mean, how does the page look?
Do you mean you are using our server-side live playlist, or how are you switching the stream?
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Switch/Close stream

Postby mirek » Fri Jan 05, 2018 2:20 am

HTTPS: I don't need to use secure websocket.
I only need to use HTML5 video on HTTPS page.
Is it possible?

I am not using server side live playlist.
The page has several links with javascript, that call RunPlayer command with different stream name.
Thank you for your help
Mirek
mirek
 
Posts: 0
Joined: Thu Jan 04, 2018 11:28 am

Re: Switch/Close stream

Postby admin » Fri Jan 05, 2018 11:30 am

"I only need to use HTML5 video on HTTPS page.Is it possible?"
Why not? How is it related to our HTML5 player? Serving web page with HTTPS has nothing to do with what you put on that page. It's the web server that serves the web page; it has nothing to do with our software.

"The page has several links with javascript, that call RunPlayer command with different stream name."
OK. You have several players on web page? So if you start another player at some point of time, why the first player should stop?
The first player will stop if you click on a Stop button, or close the web page.

I guess you may be asking of how to programmatically stop the first player with JavaScript?
That's a very good question. The player's controls bar has a stop button and you can send a click event to that button, even if the controls bar is hidden and the button is not visible.
For player created with "UnrealPlayer1" the ID of Stop button will be "UnrealPlayer1_stop".
So what you need to do is:
<script>
function stopPlayback()
{
var stopButton = document.getElementById("UnrealPlayer1_stop");
stopButton.click();
}
</script>

Similarly, you can send play/pause button clicks: the playpause button in the controls bar has an ID of "UnrealPlayer1_playpause".
Similarly, even if the controls bar is hidden, you can programmatically click on a fullscreen button; the fullscreen button has an ID of "UnrealPlayer1_fullscreen".
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Switch/Close stream

Postby mirek » Fri Jan 05, 2018 11:47 am

Hello,
thanks for your explanations.
HTTPS - I also think https is not related to playing stream via HTML5Player.
So why it run on http://www.multimedia-software.cz/cs/kamery
but not run on https://www.multimedia-software.cz/cs/kamery ?

You can also see my second troubles there.
There are 4 links on right side of the page.
I have one player on the page only.
I wish to change stream played in the player clicking one of the links.
That works for first look, but previously run stream are not closed.

Mirek
mirek
 
Posts: 0
Joined: Thu Jan 04, 2018 11:28 am

Re: Switch/Close stream

Postby admin » Fri Jan 05, 2018 12:23 pm

It is really no clear why it wouldn't work with your https webpage. Very strange. It really should work the same.
Is it completely same page returned? Maybe under HTTPS your webserver injects some http headers like use proxie servers or something?

Now, regarding your stream stopping question, simply stop the stream as I suggested, before playing next stream:

function UVPplay(idv) {
if ("MediaSource" in window && "WebSocket" in window)
{
var stopButton = document.getElementById("UnrealPlayer1_stop");
if(stopButton) stopButton.click();
.....
.....
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Switch/Close stream

Postby mirek » Fri Jan 05, 2018 12:32 pm

I believe web server IIS returns same page in both HTTP and HTTPS.
I don't use any proxy and headers there.
Two things: Both IIS and Unreal Media Server run on same server, but on different IPs. Port 443 was changed to 445 for UMS.
Any ideas?

Thanks for script for stopping previous stream - I hoped there is some builtin function, but this is acceptable solution.

Mirek
mirek
 
Posts: 0
Joined: Thu Jan 04, 2018 11:28 am

Re: Switch/Close stream

Postby admin » Fri Jan 05, 2018 1:12 pm

Could https issue be explained by this:
https://stackoverflow.com/questions/103 ... curity-err

Strangely, nobody complained about it beofre, but I guess, if you already have SSL certificate for IIS, why not to use it for secure websockets with Unreal Media Server?
So switching to secure websockets should fix your issue:
viewtopic.php?f=28&t=3489
admin
Site Admin
 
Posts: 1039
Joined: Fri Aug 21, 2009 10:13 am

Re: Switch/Close stream

Postby mirek » Sat Jan 06, 2018 3:24 am

Hello,

I read the article, but I am not sure if it is cross domain.
I think there would be much more developers touched, because it is common you run web site and UMS on different servers.

I prepared clean new html file with minimal content:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Camera</title>
<script src="/Scripts/unreal_html5_player_script_v2.js" type="text/javascript"></script>
<link href="/Scripts/unreal_html5_player_styles_v1.css" rel="stylesheet" />
</head>
<body>
<UnrealHTML5VideoPlayer id="UnrealPlayer1"></UnrealHTML5VideoPlayer>
<script type="text/javascript">
if ("MediaSource" in window && "WebSocket" in window)
RunPlayer("UnrealPlayer1", 1280, 720, "77.236.208.174", 5119, false, "mmsw_rozhledna_milirF", "", true, true, 1, "", false);
else
document.getElementById("UnrealPlayer1").innerHTML = "Media Source Extensions or Websockets are not supported in your browser.";
</script>
</body>
</html>

You can call it on www.multimedia-software.cz/camera.html with same result - HTTP works, HTTPS doesn't work :-(
Mirek
mirek
 
Posts: 0
Joined: Thu Jan 04, 2018 11:28 am

Re: Switch/Close stream

Postby mirek » Sat Jan 06, 2018 4:07 am

Hello,
I tired debug problem in browsers.

MSIE 11:
SCRIPT5022: SecurityError
unreal_html5_player_script_v2.js (1,27909)

Chrome:
unreal_html5_player_script_v2.js:1 Mixed Content: The page at 'https://www.multimedia-software.cz/camera.html' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://77.236.208.174:5119/mmsw_rozhledna_milirF'. This request has been blocked; this endpoint must be available over WSS.
unreal_html5_player_script_v2.js:1 Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
at _0x4be8x81 (https://www.multimedia-software.cz/Scri ... js:1:27922)
at MediaSource._0x4be8x74 (https://www.multimedia-software.cz/Scri ... js:1:25051)

It really seems browsers have problems with mixed content (secure and unsecure).

Do you know any way how to run web page over HTTPS with unsecure WebSocket?
I don't want to use certificate in UMS, because I plan to use UMS from different domain - web sites.

Thank you
Mirek
mirek
 
Posts: 0
Joined: Thu Jan 04, 2018 11:28 am

Next

Return to Playing with HTML5 MSE Player

Who is online

Users browsing this forum: No registered users and 1 guest

cron