Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

digcrow's avatar

Issue with Video player and suggestions.

Hello @JeffreyWay,

First, I want to thank you for all the hard work, generosity, and effort you put into making knowledge accessible and easy to understand. You've been one of my teachers since 2017, and you've helped and inspired me a great deal.

I've noticed a couple of issues/bugs:

1. Video playback speed is overwritten on page load

When I set the playback speed to 1.5x, it appears to be persisted in local storage. However, every time I reload the page or navigate to another lesson, it gets reset to the default speed (1x).

2. Fullscreen player error when moving to the next lesson

When watching in fullscreen mode and the player automatically advances to the next lesson, I get the following error:

"Invalid playback URL. The video URL or playback token is formatted with incorrect or incomplete information."

Currently, I have to exit fullscreen mode for the next lesson to load correctly.

As a suggestion, if this is related to DOM manipulation or player reinitialization, could you at least allow the video player to expand to the full page width, similar to YouTube's theater mode?

Minor issues and improvements

1. Double-click does not toggle fullscreen

It would be great if double-clicking the video toggled fullscreen mode, as users generally expect.

2. Easier rewatch experience

When I complete a lesson and revisit it later, the video starts at the end and immediately displays a popup with two buttons: Cancel and Next Episode.

Could you either:

  • Add a Rewatch button that starts the video from the beginning, or
  • Automatically reset the playback position to the start when revisiting a lesson that was previously completed and is already at the end of the timeline.

Thank you again for everything you do. Laracasts and you have been an invaluable resource throughout my career. Peace from Tunisia!

0 likes
1 reply
LaryAI's avatar
Level 58

Certainly! Let's address each issue and suggestion in turn, covering both bug fixes and enhancements. I’ll provide conceptual solutions and sample JavaScript where appropriate, assuming integration into a custom player or when extending a third-party (e.g., Video.js) is possible.


1. Video playback speed is reset on page load

Issue: The user's preferred speed is saved in localStorage but not re-applied on new page loads.

Solution: On player initialization, check localStorage for any saved playback rate and apply it. For example, if you're using the HTML5 video element:

// On player ready or page load
const video = document.querySelector('video');
const savedSpeed = localStorage.getItem('playbackRate');
if (savedSpeed) {
    video.playbackRate = parseFloat(savedSpeed);
}

// When user changes speed
video.onratechange = function () {
    localStorage.setItem('playbackRate', video.playbackRate);
};

If you’re using a video library, use its respective API/hooks to get/set playback rate.


2. Fullscreen player gives error on auto-advance

Issue: Changing videos while the player is in fullscreen causes playback URL errors, likely due to player teardown/reinit while in fullscreen.

Solution:

  • Option 1: On advancing to the next video programmatically, first exit fullscreen:
function exitFullscreenIfActive() {
    if (document.fullscreenElement) {
        document.exitFullscreen();
    }
}
// Call this right before loading the next video
exitFullscreenIfActive();
  • Option 2: Refactor the way the new video source is set so the player doesn’t need to be re-initialized, or decouple the DOM teardown from fullscreen state.

3. Theater mode (as fallback to fullscreen)

Suggestion: Offer a "theater mode" that expands video to full content width but isn’t fullscreen.

Solution:

  • Add a CSS class to toggle theater mode:
.theater-mode {
    width: 100vw;
    height: 80vh; /* adjust as needed */
    margin: 0 auto;
    background: #000;
    z-index: 50; /* or however needed */
}
  • Toggle it with a button:
document.getElementById('theater-btn').onclick = function () {
    document.querySelector('.player-container').classList.toggle('theater-mode');
};

4. Double-click does not toggle fullscreen

Enhancement: Users expect to double-click the video to toggle fullscreen.

Solution:

const video = document.querySelector('video');
video.ondblclick = function () {
    if (document.fullscreenElement) {
        document.exitFullscreen();
    } else {
        video.requestFullscreen();
    }
};

If using a custom overlay, bind the handler to the relevant container.


5. Easier rewatch experience

Issue: When revisiting a completed lesson, the video starts at the end.

Solution:

  • Option 1: Add a "Rewatch" button.
<button onclick="rewatchVideo()">Rewatch</button>
function rewatchVideo() {
    const video = document.querySelector('video');
    video.currentTime = 0;
    video.play();
}
  • Option 2: Auto-reset if video loads at the end.
const video = document.querySelector('video');
video.addEventListener('loadedmetadata', function () {
    if (video.currentTime >= video.duration - 1) { // within last second
        video.currentTime = 0;
    }
});

Summary

Each of these improvements is relatively straightforward with access to the player JavaScript and markup. Most issues stem from managing player state and session persistence; the above code blocks address the most common traps.

Note: Any implementation should be adapted to fit the specific player/library/framework that Laracasts uses (e.g., Video.js, Plyr, custom), but the provided examples are standard JavaScript and will work generally with HTML5 <video>.

Thank you for sharing your feedback and suggestions for Laracasts. These usability details make a big difference to daily users!

Please or to participate in this conversation.