7. Configure Falcon Player to work with the Internet control website

When website visitors vote on sequences, the highest voted sequence is stored on the website in a file called dynamic.json.  Falcon Player on your Raspberry Pi has a special playlist type called "dynamic" which can read this file on your website, then play the sequence therein.  Setting up this communication between Falcon Player and your Internet control website is rather easy!  Here is how to do it.

 

Create a dynamic playlist

  1. In Falcon Player, choose Content Setup > Playlists from the top menu.
  2. In the New Playlist field, type the word "Dynamic", then click the [Add] button.
  3. In the Playlist Details section on the lower half of the window, choose "URL" for the "Type" field from the drop-down list.
  4. In the URL: field, type the full address of your website, a forward slash (/), the name of the folder that you created for the Internet control system, followed by this phrase: "/prePlayActions.php".  This is case sensitive!

    For instance, the URL field for my website would be: http://itwinkle.org/control-lights/prePlayActions.php

  5. Click the [Add] button.
  6. Next, choose "Dynamic" for the "Type" from the drop-down list.
  7. For the "Source Type" field, choose "URL".
  8. In the "URL to JSON data" field, type the full address of your website, a forward slash (/), the name of the folder that you created for the Internet control system, followed by this phrase: "/dynamic.json".  This is case sensitive!

    For instance, the "URL to JSON" field for my website would be: http://itwinkle.org/control-lights/dynamic.json

  9. Click the [Add] button.
  10. In the Playlist Details section on the lower half of the window, choose "URL" for the "Type" field from the drop-down list.
  11. In the URL: field, type the full address of your website, a forward slash (/), the name of the folder that you created for the Internet control system, followed by this phrase: "/postPlayActions.php".  This is case sensitive!

    For instance, the URL field for my website would be: http://itwinkle.org/control-lights/postPlayActions.php

  12. Click the [Add] button.
  13. Lastly, choose "Pause" for the "Type" field from the drop-down list.
  14. For the "Pause Time" field, enter "3".
  15. Click the [Add] button.
  16. At this point, your dynamic playlist is created!  Click the [Save] button near the middle of the screen to save the playlist.


 

For your information, the way it works is this:

When the playlist is executed, prePlayActions.php queries the Internet control website for the sequence that it should play next.  If no one is voting, a random sequence is chosen.  Then, a custom dynamic.json file is created on the website, containing either the random sequence or the sequence with the most votes (if visitors are actively voting).  Voting is reset, allowing visitors to vote for the next sequence.

Next, Falcon Player reads dynamic.json and plays the sequence therein.

When the sequence finishes, postPlayActions.php performs minor cleanup actions.  The playlist will then run again from the beginning, ready to setup a different sequence to play.

 

Configure Falcon Player to start the dynamic playlist automatically

Note: As of Falcon Player v2.7.2, there is a bug with the dynamic "type" in playlists; the "Repeat" feature does not work properly as shown in Step 5 below.  Falcon Player v4.6.1 or higher fixes this problem, use these higher versions.

To have Falcon Player automatically start the dynamic playlist when the Raspberry Pi is powered on, do the following:

  1. Choose Content Setup > Scheduler from the top menu.
  2. Click the [Add] button.
  3. The "Start Date" field should have "(current year)-01-01" in it, while "End Date" should have "(current year)-12-31".  Leave these fields as-is.
  4. Choose "Dynamic" in the drop-down list under "Playlist".
  5. The "Days, "Start Time", and "End Time" field should have "Everyday", "00:00:00" and "24:00:00" in them, respectively.  Leave these fields as-is.  Similarly, the "Repeat" field should have a checkmark in it.
  6. Click the [Save] button.
  7. That's it!

 

When you reboot your Raspberry Pi, Falcon Player will automatically start the dynamic playlist, querying the Internet control website for the sequences that it should play.  The dynamic playlist will repeat itself automatically, so after each sequence is played, the website is queried again for the next sequence to play.

 

Congratulations, you now have Internet controlled Christmas lights!

 

Last modified on Monday, 16 August 2021 01:57

Go to top
JSN Boot template designed by JoomlaShine.com