Ruby on Rails #143 Turbo Permanent: persist Audio Video and Search results while navigating pages

23/08/2023 (8 months ago)
hotwire turbo

Often when you visiting media websites, you will want an audio or video player to keep playing even after navigating to another page (like Spotify).

data-turbo-permanent is a Turbo Drive feature that makes it very easy to persist (not refresh) elements when navigating to other pages in an app.

On Superails I use data-turbo-permanent to persist latest search results when navigating around pages.

In this episode we will keep audio and video playing across page navigation.

As a bonus, we will look at opening video picture-in-picture when navigating to another page!

Episode source code:
Based on this blogpost:

0:00 Examples of using data-turbo-permanent
2:13 Use data-turbo-permanent
3:24 permanent audio player while navigating around app
4:05 permanent video player
4:30 trigger picture-in-picture video player when navigating around the app

Sign in to join the conversation