Media Playing and SPA
there are lots of use-case which seems not necessary to make it SPA. (I means you can navigate page with state change)
but when you playing audio/video, you should do SPA. because you can’t navigate other page without terminating media playing.
for example, imagine playing audio with grabbing playlist. you can’t choice other artist/album name, without stopping current music if you don’t make it SPA. other way to make it possible is separate playlist / audio player with iframe.
If you have playlist static page and have audio/video tag in that page. you can do it only html and standard api, and that works fine for not navigating, but once you want to “continue playing while searching other music” suddenly you need to use tons of JS and learn SPA.
can’t we make it easy for continue playing while navigating ?
Page independent Media Context API
Picture in Picture seems out of window context for playing audio/video. but actually not. if you navigate parent page (who has video/audio tag of PiP), media playing will stop.
but if PinP audio player continue playing while page navigates, it seems solution.
Who playing audio/video ?
i don’t have best solution but some ideas.
ex, playing media over page will stop page navigate. but service worker are running cross page. so if audio/video can play over service worker and display in PinP seems work.
service worker response audio/video file to audio/video tag, and if user enables it PinP, that makes Page independent Context for media playing. and parent page navigates, PinP can return to audio/video tag which current page have.
I think this API will used by Ad, so its necessary to let user disable by permission, and have UI for easy to turn off.
It cover use-case like
- Audio Player (like spotify/soudcloud etc)
- Video Player (Youtube/Fulu etc)
- Video Chat
and make them easy to build static page base site (SPA free) but continue to playing critical medias.