geo10 Posted November 17, 2015 Share Posted November 17, 2015 Hi guys! Let me get straight to my question so i dont waste your time: I want to ask if how the following website you guess would be done: (correct me please if im wrong)So i lets Say you have a video stream that the website gets real time, and i want to change the video stream based on the users keyboard input in real time. The video input changing would be server sided, so that doesnt have to be calculated client side. Do you think this can be done in purely html5 or do i need a layer of JavaScript for the keyboard input?Thanks for your help in advancePs: please dont mind any typos im on my phone Quote Link to comment Share on other sites More sharing options...
alex_h Posted November 17, 2015 Share Posted November 17, 2015 In what way do you change the video input? Quote Link to comment Share on other sites More sharing options...
geo10 Posted November 17, 2015 Author Share Posted November 17, 2015 Well, like a remote desktop: the changes are computed server side and the client gets a stream of the output whats going on on the server. geo10 1 Quote Link to comment Share on other sites More sharing options...
geo10 Posted November 17, 2015 Author Share Posted November 17, 2015 But this requires real time tracking of the mouse and keyboard. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted November 22, 2015 Share Posted November 22, 2015 You need JS, yeah, just to change the video source, problem is that you probably want it to be seamless, in which case, buffering up the whole video and changing the time would probably be best i.e. stitch together all of your videos, load it all (yes, this will probably take a prohibitively long time), switch to the start time of each clip on keypress. Quote Link to comment Share on other sites More sharing options...
geo10 Posted November 23, 2015 Author Share Posted November 23, 2015 Hey!Thanks for your answer. Though I think I was missunderstood.Basicly I just want to read the mouse and keyboard events, and send them to the server in real time.I.E.:The user sees the video stream on his screen and through that he is told to press the ENTER key. I need to capture the 'enter' key press event and send it to the server real time. I wouldn't be changing the media source, the stream on the server would change according to the keypress, but that is completly server sided and the stream would be continous.So is this possible in pure HTML5 or do I need a layer of JavaScript for that? thanks for your time,geo10 Quote Link to comment Share on other sites More sharing options...
mattstyles Posted November 23, 2015 Share Posted November 23, 2015 Nope, you need JS.document.addEventListener( 'keydown', function( event ) { console.log( event.keyCode )})This code, in most browsers (not all), will show you the `keyCode` whenever a key is pressed down. The ENTER key is number 13.document.addEventListener( 'keydown', function( event ) { if ( event.keyCode === 13 ) { ...do stuff }})To send stuff to the server you’ll probably want some AJAX, either using `XMLHttpRequest` or `fetch`, although you could use a websocket implementation. Seems like overkill though. Quote Link to comment Share on other sites More sharing options...
rothers Posted November 26, 2015 Share Posted November 26, 2015 Hey!Thanks for your answer. Though I think I was missunderstood.Basicly I just want to read the mouse and keyboard events, and send them to the server in real time.I.E.:The user sees the video stream on his screen and through that he is told to press the ENTER key. I need to capture the 'enter' key press event and send it to the server real time. I wouldn't be changing the media source, the stream on the server would change according to the keypress, but that is completly server sided and the stream would be continous.So is this possible in pure HTML5 or do I need a layer of JavaScript for that? thanks for your time,geo10 This is pretty easy to code but you might find it better to manipulate the video on the user end.... that way you don't have to have some serious server processing going on. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.