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

spectral_flux's avatar

Keep video playing while switching pages Inertia/Vue/Laravel

HI, and thank you for your attention.

I'm very new (few weeks) to laravel and vue. What I'm trying to accomplish is something like Laracast own site or youtube where if you are watching a video and switch to another page it still keeps playing the video on a mini player on the bottom right corner.

I tried using keep-alive but learned it won't work.

I really did a thorough search, I found a solution but that uses vue router but I'm using laravel with inertia.

Would it be possible to do this using the Laravel/Inertia/Vue stack with laravel router?

If so, please help me, Obi-Wan Kenobi. You're my only hope.

If some just point me to the right direction I think I can acomplish but searching google and forums was of no help.

Thank you in advance.

0 likes
5 replies
drehimself's avatar
Level 35

Check out this section in the Inertia docs about Persistent layouts: https://inertiajs.com/pages#persistent-layouts

You're going to want to render the "floating" component in there so it persists across multiple page visits. Maybe even portal it in there using portal-vue.

I highly recommend playing with the demo "Ping CRM" app for Inertia: https://github.com/inertiajs/pingcrm

Once you have that setup, add the following as the last element before the closing div in Layout.vue

<div class="fixed bottom-0 right-0 z-50">
    This is a floating player
</div>

Now click around to other pages and you'll notice that this element remains there because it's being rendered in the Layout component instead of a specific page.

As for the floating player, that could differ based on what type of player you're using. I'd imagine just rendering it in a smaller size should work?

Hope this helps.

1 like
spectral_flux's avatar

Hey @drehimself

Thank you so much for your reply.

After reading your links I tried to implement the solution (Just the persistent-layout, without the portal for now). I get the portal part and want to set that apart for now.

I really hate be (or look) as one of those people that want everything chewed up for they (hand to god I'm not) but I still stuck, so if you may please bear with me.

I taught I did what is in here https://inertiajs.com/pages#persistent-layouts

In this file: https://github.com/luisalonsobr/vueeve/blob/master/resources/js/Layouts/AppLayout.vue On line 291 it's the component "mini-player" wich is what I'm trying to persist.

And the component itself it's here: https://github.com/luisalonsobr/vueeve/blob/master/resources/js/Components/MiniPlayer.vue

But I guess I'm misinterpreting something on the Inertia documentation

I uploaded the site to https://test.luisalonso.com.br user [email protected] pass testtest

You think you (Or anyone) could take a look at the files above and tell me what I'm missing?

Thank you once again.

spectral_flux's avatar

I realized what I was doing wrong,

I was passing the layout as a component on my pages, not as a layout so it was no persisting.

I need to test a bit more but I think i figured it out.

Thx again @drehimself

1 like
spectral_flux's avatar

Hey @eskiesirius , I did it using by using the main layout with the AppLayout directive on the page export. I was not managing to acomplish it before because I was loading the main layout as a component.

Let me know if you need more info.

Please or to participate in this conversation.