Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video auto pause when clicking another tab chrome #742

Closed
son-bh opened this issue Apr 15, 2024 · 8 comments
Closed

Video auto pause when clicking another tab chrome #742

son-bh opened this issue Apr 15, 2024 · 8 comments

Comments

@son-bh
Copy link

son-bh commented Apr 15, 2024

Expected behaviour

I stream straight from a .flv link using Artplayer. However, the player is instantly stopped by the player when I click to another Chrome tab. Even if I switch to a different tab, I still want the player to play.

My config:

function playFlv(video, url, art) {
  if (FlvJs.isSupported()) {
    if (art.flv) art.flv.destroy()
    const flv = FlvJs.createPlayer({ type: 'flv', url })
    flv.attachMediaElement(video)
    flv.load()
    art.flv = flv
    art.on('destroy', () => flv.destroy())
  } else {
    art.notice.show = 'Unsupported playback format: flv'
  }
}

 const art = new Artplayer({
      ...option,
      autoplay:true,
      muted: true,
      playbackRate: true,
      aspectRatio: true,
      fullscreen: true,
      fullscreenWeb: true,
      playsInline: true,
      setting: true,
      container: artRef.current,
      customType: {
          flv: playFlv 
      },
    })
@zhw2590582
Copy link
Owner

@son-bh
Copy link
Author

son-bh commented Apr 17, 2024

I use link .flv from https request.
Link example: https://pull06.scstream.net/live/stream-9911957_lhd.flv

@zhw2590582
Copy link
Owner

I can't access your flv link, can you give me the demo address?

@son-bh
Copy link
Author

son-bh commented Apr 24, 2024

You can try https://pull06.scstream.net/live/stream-9912052_lhd.flv?auth_key=1713930551-0-0-edc0fb05169987e38434fe67bd8386c1. The link will expire after 90 minutes and you can't use it.

@zhw2590582
Copy link
Owner

I tested it here and there is no problem: demo

@son-bh
Copy link
Author

son-bh commented Apr 24, 2024

Can you try config autoplay: true, muted: true,. When i configure it up like that the problem happens.

@zhw2590582
Copy link
Owner

This is a problem with flv.js, you can refer to this solution: bilibili/flv.js#259 (comment)

@son-bh
Copy link
Author

son-bh commented Apr 24, 2024

Oh. Let me check. I will close issue. Thank for you help.

@son-bh son-bh closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants