tonyportersec
Member
I followed the
to do,
and i want to display the video which will change the video aspect ratio to fit the size of the videoControls as below:
the testing page is https://server3.teleeye.link/recording/player-min.html
If you open the page and click the "PLAY" button, you will find that the video can change aspect ratio on MS Windows chrome, edge, android chrome,
correct.png (You can see the video is fit the aspect ratio (960 x 270), and nothing is cut on the video)
but not on ios's safari.
incorrect.png (You can see the video is cut top and bottom
Do you know Why? Thanks
The reason why i need to do it is i want to display the video to different aspect ratio, but keep all the content of the video)
player-min.html:
<!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="player-min.js"></script>
</head>
<body onload="init_api()">
<div id="remoteVideo" class="display">
<video id="videoControls" style="object-fit:fill;width:960px;height:270px"></video>
</div>
<br/><input type="button" onclick="connect()" value="PLAY"/>
</body>
</html>
player-min.js:
//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() {
console.log("init api");
Flashphoner.init({
});
}
//Connect to WCS server over websockets
function connect() {
session = Flashphoner.createSession({urlServer: "wss://server4.teleeye.link:8443"}).on(SESSION_STATUS.ESTABLISHED, function(session){
console.log("connection established");
playStream(session);
});
}
//Playing stream with given name and mount the stream into myVideo div element
function playStream() {
var options = {
name:"test1",
display:document.getElementById("remoteVideo"),
remoteVideo: document.getElementById("videoControls"),
transport: "TCP",
receiveAudio: false
};
var stream = session.createStream(options).on(STREAM_STATUS.PLAYING, function(stream) {
console.log("playing");
});
stream.play();
}
and i want to display the video which will change the video aspect ratio to fit the size of the videoControls as below:
the testing page is https://server3.teleeye.link/recording/player-min.html
If you open the page and click the "PLAY" button, you will find that the video can change aspect ratio on MS Windows chrome, edge, android chrome,
correct.png (You can see the video is fit the aspect ratio (960 x 270), and nothing is cut on the video)
but not on ios's safari.
incorrect.png (You can see the video is cut top and bottom
Do you know Why? Thanks
The reason why i need to do it is i want to display the video to different aspect ratio, but keep all the content of the video)
player-min.html:
<!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="player-min.js"></script>
</head>
<body onload="init_api()">
<div id="remoteVideo" class="display">
<video id="videoControls" style="object-fit:fill;width:960px;height:270px"></video>
</div>
<br/><input type="button" onclick="connect()" value="PLAY"/>
</body>
</html>
player-min.js:
//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() {
console.log("init api");
Flashphoner.init({
});
}
//Connect to WCS server over websockets
function connect() {
session = Flashphoner.createSession({urlServer: "wss://server4.teleeye.link:8443"}).on(SESSION_STATUS.ESTABLISHED, function(session){
console.log("connection established");
playStream(session);
});
}
//Playing stream with given name and mount the stream into myVideo div element
function playStream() {
var options = {
name:"test1",
display:document.getElementById("remoteVideo"),
remoteVideo: document.getElementById("videoControls"),
transport: "TCP",
receiveAudio: false
};
var stream = session.createStream(options).on(STREAM_STATUS.PLAYING, function(stream) {
console.log("playing");
});
stream.play();
}
Attachments
-
371.5 KB Views: 233
-
411.9 KB Views: 249
Last edited: