Jump to content

Theoretical question [newbie]


geo10
 Share

Recommended Posts

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 advance

Ps: please dont mind any typos im on my phone :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...