How to make AutoPlay work on HEI Network

How to make AutoPlay work on HEI Network

Hey there everyone. Like many of you, I hate the fact that the AutoPlay feature on the HEI Network is busted. I found a solution and it's pretty easy! I have only tried it on chrome, so YMMV.

  1. Download the tampermonkey chrome extension. This is what allows you to fix the code under the hood. The link is https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en
  2. Once installed, click the puzzle piece icon to the right of the url box in chrome, and then click on Tampermonkey. It will open a dialogue box, and you will click "create a new script." You may need to enable the plugin first.
  3. A new tab will open and you will see a a big, intimidating text box with some code already loaded in it. Select all that code and delete it, starting fresh.
  4. Copy and paste the following code block into that big text box. Then save it and you are good to go!
  5. Veg out and watch the Full Cinema playlist back to back to back <3

&#8203;

// ==UserScript==
//          HEI Network - Fix Playlist Autoplay
//     heinetwork.autoplay.fix
//       1.1
//   Makes the Autoplay toggle on heinetwork.tv actually advance to the next episode.
//         https://www.heinetwork.tv/*
//        document-idle
// u/grant        none
// ==/UserScript==

(() =&gt; {
  'use strict';

  const KEY = 'hei:autoplay';
  const q = (sel, root = document) =&gt; root.querySelector(sel);
  let armed = false;

  function nextUrl(pl) {
    let slug = (pl.dataset.nextSlug || '').trim();
    if (!slug) {
      try {
        const list = JSON.parse(pl.dataset.json || '[]');
        const i = list.indexOf(pl.dataset.currentSlug);
        if (i &gt; -1 &amp;&amp; i + 1 &lt; list.length) slug = list[i + 1];
      } catch (e) { /* ignore */ }
    }
    if (!slug) return null;
    const path = (pl.dataset.playlistPath || '').replace(/^\/+|\/+$/g, '');
    return location.origin + '/' + (path ? path + '/' : '') + slug + '/';
  }

  function setState(on, host, toggles) {
    armed = on;
    try { localStorage.setItem(KEY, on ? '1' : '0'); } catch (e) { /* ignore */ }
    toggles.forEach(t =&gt; { if (t.checked !== on) t.checked = on; });
    host.autoplay = false;
    try { delete host._nextSlug; } catch (e) { /* ignore */ }
  }

  function startPlayback(media, wasMuted) {
    if (!media || !media.paused) return;
    media.play().catch(() =&gt; {
      media.muted = true;
      media.play().then(() =&gt; {
        const b = q('#unmute-video');
        if (b) b.classList.remove('hidden');
      }).catch(() =&gt; { media.muted = wasMuted; });
    });
  }

  function init() {
    const host = q('hei-video');
    const pl = q('hei-episode-playlist');
    if (!host || !pl) return false;

    const controller = host.$controller || q('media-controller', host);
    const media = (controller &amp;&amp; controller.media) || q('video', host) || host.$video;
    const mux = host.$video;
    if (!media) return false;

    if (host.__heiAutoplayFix) return true;
    host.__heiAutoplayFix = true;

    const toggles = Array.from(document.querySelectorAll('.autoplay-toggle'));

    let saved = false;
    try { saved = localStorage.getItem(KEY) === '1'; } catch (e) { /* ignore */ }
    setState(saved || toggles.some(t =&gt; t.checked), host, toggles);

    toggles.forEach(t =&gt; ['change', 'click'].forEach(ev =&gt;
      t.addEventListener(ev, () =&gt; setState(t.checked, host, toggles))
    ));

    let leaving = false;
    const onEnded = () =&gt; {
      if (!armed || leaving) return;
      const url = nextUrl(pl);
      if (!url) return;
      leaving = true;
      location.assign(url);
    };
    media.addEventListener('ended', onEnded);
    if (mux &amp;&amp; mux !== media) mux.addEventListener('ended', onEnded);

    if (armed) {
      const wasMuted = media.muted;
      if (media.readyState &gt;= 3) startPlayback(media, wasMuted);
      else media.addEventListener('canplay', () =&gt; startPlayback(media, wasMuted), { once: true });
    }

    return true;
  }

  if (!init()) {
    const mo = new MutationObserver(() =&gt; { if (init()) mo.disconnect(); });
    mo.observe(document.documentElement, { childList: true, subtree: true });
    setTimeout(() =&gt; mo.disconnect(), 20000);
  }
})();
u/dumbugg — 1 day ago

"Don't forget what I could do to you. Don't forget what I have done for you."

Is it just me or are these lyrics the most openly sinister shit Tim has said 💀 I love the Oscar Medley 22, but every time I hear that part - which has NOTHING to do with movie titles btw - I realize how that transactional abuse taints every element of Tim's life. Makes me remember how uncomfortable the Wendy Kerby Special was and how he practically threatened to call ICE on Axiom and Manuel so that he could control them via a work visa. 0 bags of popcorn and a little copy of the DSM-5 to thumb through.

reddit.com
u/dumbugg — 1 day ago

Do you think we'll get a new Trial of Tim Heidecker?

I just finished my first complete listen through of the show and at the very end of the Road to Phoenix, I started thinking about a NEW trial of Tim Heidecker. One that connects the Argentinian amatos, the doodle dots, the governorship, and his elder abuse of G amato. Do you think it's in the works?

reddit.com
u/dumbugg — 5 days ago

AT&amp;T Phone Service

Does anyone here have ATT for cell phone provider? We have Verizon and are considering switching, but we keep hearing mixed reviews about ATT cell signal. We live on the west side of town.

reddit.com
u/dumbugg — 8 days ago

Site to help find episodes and lines

I'm a huge home movies fan and, like a lot of folks on this subreddit, often ask myself "when did Brendon talk about the lead actor in Tron?" or "what episode did Eric make out in journal class?"

Well I built a website to solve that problem! Home Movies Search let's you find any episode via key words, phrasing, etc. Every episode is transcribed and searchable! Plus you can watch the show from that line onwards in site! No more pulling your hair out looking for episodes 🖤

And it's free forever! So it is NOT time to pay the price.

homemoviessearch.netlify.app
u/dumbugg — 1 month ago
▲ 101 r/jimebrown

Rare photo of Jim E SMILING!

this song has the catchiest melody

u/dumbugg — 2 months ago
▲ 280 r/Pensacola

Shoutout to the person putting "Flock Camera" signs up

Some brave soul is putting up "flock camera" signs on the poles of flock cameras to raise awareness of mass surveillance. Whoever you are, I love you and thank you for your service. Fuck the pigs for taking them down - class traitor activity.

reddit.com
u/dumbugg — 2 months ago
▲ 21 r/jimebrown+1 crossposts

This song feels like it came from the Twin Peaks Universe

I love this 19 year old artist from didsbury and this song of his from 5 years ago reminds me of Twin Peaks music.

youtu.be
u/dumbugg — 2 months ago

Best place to get wedding rings cleaned?

I want to get our wedding rings cleaned but they have salt and pepper diamonds which means they can't just be thrown in a sonicator. Anyone have recommendations?

reddit.com
u/dumbugg — 3 months ago
▲ 590 r/twinpeaks

Just watched this again...

And God dayum does Albert knock the delivery out of the park!

u/dumbugg — 3 months ago

Connection Between Metalocalypse &amp; Home Movies (Both Brendon Small Projects)

My two favorite shows are Home Movies and Metalocalypse and I always notice connections between them. Here is a common thread of "if it's not easy, it's not worth doing" about ten years apart.

u/dumbugg — 3 months ago

Connection Between Home Movies &amp; Metalocalypse (Both Brendon Small projects)

My two favorite shows are Home Movies and Metalocalypse and I always notice connections between them. Here is a common thread of "if it's not easy, it's not worth doing" about ten years apart.

u/dumbugg — 3 months ago