Hello all, newbie here.
I want to provide my broadcasters with a simple tool, so I grabbed this piece of code that works fine on desktops (as far as I tried), but the "publish" button will not do anything on a smartphone.
Any clues?
I'm also open to an alternative solution anyone may have.
My code:
HTML:
JAVASCRIPT: (twoway.js)
I want to provide my broadcasters with a simple tool, so I grabbed this piece of code that works fine on desktops (as far as I tried), but the "publish" button will not do anything on a smartphone.
Any clues?
I'm also open to an alternative solution anyone may have.
My code:
HTML:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="https://flashphoner.com/downloads/builds/flashphoner_client/wcs_api-2.0/current/flashphoner.js"></script>
<script type="text/javascript" src="twoway.js"></script>
</head>
<body onload="init_api()">
<div id="publish" style="width:320px;height:240px;border: solid 1px"></div>
<br/><input type="button" onclick="connect()" value="Publish"/><br/>
<br/>
<div id="play" style="width:320px;height:240px;border: solid 1px"></div>
<br/><input type="button" onclick="clickplay()" value="Play"/>
</body>
</html>
Code:
//Status constants
var SESSION_STATUS = Flashphoner.constants.SESSION_STATUS;
var STREAM_STATUS = Flashphoner.constants.STREAM_STATUS;
//Websocket session
var session;
//Init Flashphoner API on page load
function init_api() {
Flashphoner.init({});
}
//Connect to WCS server over websockets
function connect() {
session = Flashphoner.createSession({
urlServer: "wss://157.245.88.XXX:8443"
}).on(SESSION_STATUS.ESTABLISHED, function(session) {
publishStream(session);
});
}
//Publish stream
function publishStream(session) {
session.createStream({
name: "tandelaf",
display: document.getElementById("publish"),
}).publish();
}
//Playing stream
function clickplay() {
playStream(session);
}
function playStream(session) {
session.createStream({
name: "tandelaf",
display: document.getElementById("play"),
}).play();
}
Last edited by a moderator: