Board index FlightGear Development New features

Simple refresh-based Screen stream simulator!

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Simple refresh-based Screen stream simulator!

Postby Parnikkapore » Sat Nov 21, 2015 1:04 am

Hey all!
Having the news that Phi's MJPEG streaming is halfway-working, I developed this HTML5 "Screenshot streamer" for everyone to have fun with! :D :D
Working principle
When loaded, this will make a request to the Mongoose screenshot handler, OVER AND OVER. Images will be displayed ON TOP of the other, giving a movie illusion.
Installation
-copy the following code into a new html file. ex: Anim.htm
-place this in the Phi folder
-Start up FG AND MONGOOSE(httpd),and access the page. ex: localhost:3437/Anim.htm(This works :) )
Caveats
Resize the window to get Fullscreen!
Tested in Chrome only!
Code
<!doctype html5>
<style>
#cvShot:{
position:fixed;
left:0;
top:0;
width:100%;
height:100%;
}
</style>
<canvas id="cvShot" />
<script>
var cvshot = document.getElementById('cvShot').getContext('2d');
var cvEle = document.getElementById('cvShot');
var shotImg = new Image();

function DrawShot(){
cvshot.drawImage(shotImg, 0, 0);
shotImg.src = '/screenshot?' + Math.random();
};

shotImg.addEventListener('load' ,DrawShot ,false);

shotImg.src = '/screenshot';

window.addEventListener('resize', resizeCanvas, false);

function resizeCanvas() {
cvEle.width = window.innerWidth;
cvEle.height = window.innerHeight;
}

</script>
Last edited by Parnikkapore on Sat Nov 21, 2015 10:22 am, edited 1 time in total.
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screenshot Streamer!

Postby legoboyvdlp » Sat Nov 21, 2015 1:36 am

Good! Make sure to send it on to Torsten-with-no-t so it may be included wih 3.8 ;)
User avatar
legoboyvdlp
 
Posts: 7325
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

Re: Simple refresh-based Screenshot Streamer!

Postby Parnikkapore » Sat Nov 21, 2015 1:53 am

Don't know how to...
Can anyone who knows send a Mailing list or PM to him?
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screenshot Streamer!

Postby legoboyvdlp » Sat Nov 21, 2015 2:04 am

ucp.php?i=pm&mode=compose

Then you can type in Torsten in the first box below Compose Message and your message in the 2nd box.
User avatar
legoboyvdlp
 
Posts: 7325
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

Re: Simple refresh-based Screenshot Streamer!

Postby Parnikkapore » Sat Nov 21, 2015 7:24 am

He blocked himself out! I'll try hooray...
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screenshot Streamer!

Postby Parnikkapore » Sat Nov 21, 2015 7:28 am

Yeah. Sent it to Hooray. Hope we had a response soon.
FG is community-based. Anyone has tips for the prototype?
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screenshot Streamer!

Postby Torsten » Sat Nov 21, 2015 8:58 am

The MJPEG encoder is already included.
Code: Select all
stream=y

Should start the mjpeg stream and sends out one jpg screenshot with each frame.
Be careful with flightgear's screen size. This easily hogs your CPU or your bandwidth.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 637
Joined: Fri Feb 01, 2008 9:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Simple refresh-based Screenshot Streamer!

Postby Parnikkapore » Sat Nov 21, 2015 10:13 am

I KNEW THAT,Torsten;hence this section on the first post:
"Having the news that Phi's MJPEG streaming is halfway-working"
On my machine,THIS is what happens if I try it:
-to access it, go to /screenshot then /screenshot?stream=y . Otherwise, or if a browser refreshes,FG crashes.
-WAY lower framerates than this
-on some browsers(notably IPad)using MJPEG results in a white screen when frames are loading.
THOSE are why I'm working on this as a temporary replacement of yours.
P.S. If there's a commit on the RC relating with this, tell me and I'll try again.
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screen stream simulator!

Postby Parnikkapore » Sat Nov 21, 2015 10:23 am

It seems like torsten is offended by the topic name,so I changed it.
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screen stream simulator!

Postby Torsten » Sat Nov 21, 2015 10:34 am

Parnikkapore wrote in Sat Nov 21, 2015 10:23 am:It seems like torsten is offended by the topic name,so I changed it.

I'm not.

I can't reproduce a crashing FG using the mjpeg streamer here. If you have a gdb stacktrace or a coredump, I might have a look.
Not all browsers support mjpeg natively, Firefox does and it works perfectly for me

However, the screenshot service is by no means designed to be a streaming service. It puts way to much load on FG and is awfully inefficient. Don't use it that way.
Video streams are better implemented using a stream encoder like ffmpeg or alike (not implemented yet).

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 637
Joined: Fri Feb 01, 2008 9:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Simple refresh-based Screen stream simulator!

Postby Parnikkapore » Sat Nov 21, 2015 11:23 am

OK thanks for the second-to-last indent :)
Both of my test browsers (chrome and safari)DO work with MJPEG. The frames are displayed. They just turn white on new frames(slow connections)which is not a good thing.
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screen stream simulator!

Postby Hooray » Sat Nov 21, 2015 1:13 pm

Regarding your PM:
Parnikkapore wrote:I'm targeting this to be a Tryout,but Legoboy suggested including this in 3.8.
viewtopic.php?f=6&t=28047&p=265253#p265246


please get in touch with Torsten about this
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11472
Joined: Tue Mar 25, 2008 8:40 am

Re: Simple refresh-based Screen stream simulator!

Postby Parnikkapore » Sun Nov 22, 2015 12:32 am

BTW, this is my core dump after the direct-access issue.
FG3.6 build 191
https://onedrive.live.com/redir?resid=2 ... file%2czip
There are free alternatives to every program you encounter. You just have to find them.
Parnikkapore
 
Posts: 818
Joined: Thu Oct 29, 2015 10:16 am
Callsign: HS-FGS
Version: next [PPA]
OS: Mint 18

Re: Simple refresh-based Screenshot Streamer!

Postby D-ECHO » Wed Jan 06, 2016 11:16 am

legoboyvdlp wrote in Sat Nov 21, 2015 1:36 am:Torsten-with-no-t

How does that work?
Orsten?
;)
User avatar
D-ECHO
 
Posts: 1750
Joined: Sat May 09, 2015 12:31 pm

Re: Simple refresh-based Screen stream simulator!

Postby legoboyvdlp » Wed Jan 06, 2016 12:34 pm

It's actually meant to be: Torsten-with-no-h to distinguish between the SpaceShuttle young Thorsten Renk and the older Phi Torsten Dreyer.
User avatar
legoboyvdlp
 
Posts: 7325
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

Next

Return to New features

Who is online

Users browsing this forum: No registered users and 1 guest