Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes you can do this with the help of Ajax + jPlayer. </p> <p>Essentially what you are going to want to do is set up jPlayer on page1 to keep calling a php file on your backend that checks for any new commands. Here it is a pseudo code, if you need more help I can write actual code that does it.</p> <p>page1.php</p> <ul> <li>calls api.php every 5 seconds and expects a JSON obj back</li> <li>has functions setup to pass commands received from the AJAX call to jPlayer</li> </ul> <p>page2.php</p> <ul> <li>Has buttons/links/whatever that call api.php and set </li> </ul> <p>api.php</p> <ul> <li>2 purposes, set and retrieve data</li> <li>When asked to set data it writes a command to the DB</li> <li>When asked to retrive data is queries the DB for all un-run queries (Field that is true/false) and then updates the DB to set those command to "ran" so that they are only executed once</li> </ul> <p>Here is how it would look in practice </p> <ul> <li>page1 is loaded and video starts playing while checking api.php every 5 seconds via AJAX</li> <li>page2 calls api.php and tells it to pass on the command "pause"</li> <li>api updates the DB with the command "pause"</li> <li>page1's AJAX call hits api.php which in turn checks the DB, returns "pause", then updated the DB the mark "pause" as already ran</li> </ul> <p>Of course know that you will need to protect against SQL injection via api.php as you don't want some attacker to send a fake command to api.php. To protect against this I would suggest whitelisting commands (play, pause, next, prev, skip to, etc) so that there is a limit to what your script is capable of.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload