Create an instant "APOD Station" in your Science Center

Introductions, Rules, Announcements, and Feedback
User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Create an instant "APOD Station" in your Science Center

Post by RJN » Mon Nov 25, 2019 12:59 am

A never-ending stream of recent APODs being displayed and read aloud, one after the other, is now possible with a minimal investment -- right in your school or science center. All you need is a Internet-connected display device such as a computer, laptop, tablet, or smartphone. And power. You might have an old device like this lying around.

Here is what you do after opening a browser window.

1. Load the YouTube page https://www.youtube.com/watch?v=qJVBpFV ... bvWRSs8WQp.

2. Click on "Loop playlist".

3. Click on "Shuffle playlist".

4. Click the Play button (if it is not playing already).

5. Maximum the YouTube window to encompass the entire screen.

That's it! Thanks to Videotizer for making this available. The text readings are all done by any of a number of "artificial intelligence" voices, some of which have British accents (and some have American accents). I am planning to set up an "APOD Station" in a hall here at my university (Michigan Tech) running this. If you think your students, museum goers, public, etc. would benefit, please do the same! Please also respond to this thread and tell me how it is working out.

- RJN

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Mon Nov 25, 2019 2:53 am

@RJN

I'm truly humbled and grateful that you chose something I did to be used in the first APOD Station!

Thank you so much!

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Mon Nov 25, 2019 9:34 pm

After running some tests, @RJN reported that the playlist stops when it reaches the most recently uploaded video and doesn't continuously loop as expected.

The tests were conducted as follows: When searching if anyone else faced a similar problem, I found that many people are facing the same issue, considered as a YouTube bug. There is an active discussion in this thread where Daniel Kosa mentioned that turning "Autoplay" off fixed the issue.

Currently @RJN is running a test by keeping Loop off, and Shuffle on. I'll run my own tests too and will keep everyone posted.

Please share your experience if you faced this issue before or know of a workaround/solution.

User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Re: Create an instant "APOD Station" in your Science Center

Post by RJN » Mon Nov 25, 2019 9:42 pm

As reported, I just concluded a test with Loop off and Shuffle on. The answer is that the videos played for what might have been two hours, but then eventually stopped. For reasons I don't understand, the last video it played was 2019 November 19, which was not the last video in the playlist. One hypothesis is that YouTube played every video in the playlist exactly once, and then stopped when it had played them all. But I am not sure. I will try to think of another way to keep these APOD videotizer videos playing sequentially without human intervention.

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Mon Nov 25, 2019 11:10 pm

I created a new playlist to make testing easier. The playlist contains 4 videos only and can be played at the following URL: https://www.youtube.com/watch?v=F8qxp2- ... L5_xYcYZ7W

When I did the tests, everything seemed to work as expected; meaning, it shuffled and looped continuously. Here's my settings while testing:
  • Started with first video in playlist
  • Loop Enabled
  • Shuffle Enabled
  • Tested as both signed in and signed out of YouTube account
  • Autoplay Enabled while signed out (Autoplay button only shows up when playing the playlist's last video)
  • Browser Firefox v70.0
Please test it out to see if you have different results than mine.

User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Re: Create an instant "APOD Station" in your Science Center

Post by RJN » Wed Nov 27, 2019 3:07 am

Thanks, videotizer, for creating that short playlist. Running it has allowed me to confirm that the reason that YouTube Shuffles stop is not that all of the videos are played. Reading on the web, another possibility is that there is some rare mistake in the web connection that creates an error that, when trapped, ends looping. If I was YouTube, though, I would place a "timeout" command that activates only after a few hours to avoid having my bandwidth saturated by forgotten long playlist requests. I continue to do testing, and I encourage others to do so as well and report their results here!

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Wed Nov 27, 2019 4:30 am

Glad to know it helped!

I’ll try replicating your case by intentionally dropping my connection and see if there’s a way around it.

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Wed Nov 27, 2019 6:12 am

Here's the details of a new test I just conducted:

Environment and Settings:
  • OS: Ubuntu 16.04
  • Browser: Firefox v70.0 (Private browsing mode)
  • Playlist: APOD Test Loop
  • Not signed in to YouTube account
  • Loop: Enabled
  • Shuffle: Enabled
  • Autoplay: Enabled
Actions performed and their outcome:
  1. Start playlist and let it play 4 videos
  2. While playing the last video in the playlist, I did the following:
    1. I disabled my internet connection for a few minutes. During this period the video stopped playing, which is normal as I was disconnected from the internet
    2. I re-enabled my internet connection, and the video resumed playing from where it was stopped (without my interaction with YouTube player)
    3. Once the video finished, the playlist played another random video as it was doing prior to disabling the connection (again without my interaction)
  3. Repeated the same test above but this time when the 1st playlist video was playing. The results were the same as above; the playlist resumed playing as expected (it played random videos and looped continuously)
As I wasn't able to replicate what happened, can you please try repeating the steps I did and use similar settings as the ones I used. Can you also provide details about your OS and Browser, maybe it's a browser issue.

User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Re: Create an instant "APOD Station" in your Science Center

Post by RJN » Thu Nov 28, 2019 12:04 am

I still have not been able to figure out why YouTube APOD playlist loops stop. Videotizer pointed out that a Google search shows others have had this problem with other playlists in other contexts, but no clear solution has been proposed. I can now confirm that my home Mac ran into the same problem, but I don't know after how long. I am currently re-running it on my home Mac and so far, after more than an hour, the APOD YouTube playlist loop is still going. Ultimately, though, if no solution is found, another (hopefully) simple way to loop these short APOD videos should be promoted.

User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Re: Create an instant "APOD Station" in your Science Center

Post by RJN » Thu Nov 28, 2019 12:22 am

My last experiment has now crashed -- specifically the looping APOD playlist on YouTube starting playing a video outside the playlist and not from APOD. I think it went "off course" between one and two hours. Here is an odd clue: the Chrome browser "back" button no longer pointed to the last YouTube video run. It was grayed out and was not even clickable. When looping the APOD videos, I could always click the browser back button to see which past APOD videos from the playlist had played. But once it crashed out of the playlist, that stopped too. Still stumped!

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Thu Nov 28, 2019 7:29 am

Thanks for the details.

Can you please test it with the webpage I created as Option 2? Here's the steps:
  • Go to https://apod-playlist.netlify.com/?play ... L5_xYcYZ7W - This will play the test playlist containing 4 videos only. For playing the main APOD playlist simply go to https://apod-playlist.netlify.com/
  • The playlist should autoplay, if it doesn't simply click on the play button
  • The player occupies all the webpage and is responsive, so it can be viewed on any screen size. You can also view it full screen by clicking on the "Full screen" button located at the right bottom corner.
During my tests, everything worked as expected, even after I disconnected from the internet.

User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Re: Create an instant "APOD Station" in your Science Center

Post by RJN » Fri Nov 29, 2019 4:03 am

Yes, so far this netlify player works for me too -- going well over 2 hours now! Can this be page be automatically updated to include the latest APOD videotized on YouTube? Can this page be hosted on apod.com or apod.nasa.gov instead of netlify?

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Fri Nov 29, 2019 6:09 am

Great!
RJN wrote:
Fri Nov 29, 2019 4:03 am
Can this be page be automatically updated to include the latest APOD videotized on YouTube?
Yes! It contains a script that updates the playlist videos IDs every time a video is played - it's the same function that's used to get a random video.
RJN wrote:
Fri Nov 29, 2019 4:03 am
Can this page be hosted on apod.com or apod.nasa.gov instead of netlify?
Of course! You can host it anywhere you like. The source code of this page can found at GitHub by going to https://gist.github.com/videotizer/d90c ... ae09bcddfe. You can use it however you like, and if you need to update it in anyway, simply let me know and I'll be more than happy to do it for you.

User avatar
RJN
Baffled Boffin
Posts: 1530
Joined: Sat Jul 24, 2004 1:58 pm
Location: Michigan Tech

Re: Create an instant "APOD Station" in your Science Center

Post by RJN » Sun Dec 01, 2019 8:16 pm

Videotizer -- Excellent! I have now downloaded that HTML code from GitHub and then uploaded it onto the main NASA server. It is available here: https://apod.nasa.gov/apod/fap/VideoLoopTest.html. It seems to run forever without errors or stopping!

I had a quick look at the code but don't yet understand how it works. Does it randomly play codes from a specific YouTube directory? If so, which directory? Where in the HTML code is this directory mentioned? Thanks again for your programming and continued help!

- RJN

videotizer
Ensign
Posts: 14
Joined: Thu Nov 21, 2019 10:24 pm

Re: Create an instant "APOD Station" in your Science Center

Post by videotizer » Mon Dec 02, 2019 3:39 pm

Awesome!
RJN wrote:
Sun Dec 01, 2019 8:16 pm
Does it randomly play codes from a specific YouTube directory?
Yes, it randomly selects a video ID form the set YouTube playlist. This is handled by onPlayerStateChange function.
RJN wrote:
Sun Dec 01, 2019 8:16 pm
If so, which directory? Where in the HTML code is this directory mentioned?
It plays the videos from the primary APOD playlist. This playlist has all APOD videos and is auto updated every time a new video is auto generated and auto uploaded. The ID of this playlist is 'PLN7CbH97ZxIjz3xhBHGzfGfbvWRSs8WQp', and you can find that this ID is set as default in the code at line 26. The code can also accept other playlists if it's set as a parameter in the URL; for example, if you need to play APOD 2019-December playlist, you can simply set the URL as follows: https://apod.nasa.gov/apod/fap/VideoLoo ... mscT3JnUWI. This means that you can play any playlist you want, and if no playlist ID is used, it will default to the primary APOD playlist.

Please let me know if you need any additional clarifications.