Y
Y
Yoshimoto2017-05-12 12:56:09
Vue.js
Yoshimoto, 2017-05-12 12:56:09

How to stop downloading and playing video in SPA app when navigating to another page?

There is an application created using SPA technology using Framework7 + Vue. There is a video on one page. It is necessary that the video download and playback stop when you go to another page.
Poke where to read about it, or give advice in which direction to look.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RaulDuke, 2017-05-12
@RaulDuke

Something like this?

router.beforeEach((to, from, next) => {
  if (from.matched.some(record => record.meta.hasMultimedia)) {
    stopAllPlayings();
    next();
  } else next();
});

const routes = [
  {
    path: '/funnyCatsVideos',
    component: require('./views/funny-cats-videos.vue'),
    name: 'videos',
    meta: { hasMultimedia: true }
  },

E
Evgeny Kulakov, 2017-05-12
@kulakoff Vue.js

Depends on how the app is navigated. If vuerouter is used, then you can try using hooks: https://router.vuejs.org/en/advanced/navigation-gu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question