2024年8月6日发(作者:卫生间用什么做隔断最好)

Example: Play & Pause

That's great for this simple example but what if you use

()

to be able to play a video later?

I'll tell you a secret. You don't have to use

()

, you can use

()

and here's how:

Example: Fetch & Play

Warning: Don't make your

onButtonClick

function asynchronous with the

async

keyword. You'll lose the "user gesture token" required to allow

your video to play later.

Play promise support

At the time of writing,

()

returns a promise in , Firefox, Opera, and . is still working on it.

Danger zone

within

makes

play()

promise never rejects

For

, the

play()

promise rejects as expected as the video doesn't exist. For

, the

play()

promise never rejects. It only happens if there are no valid sources.


更多推荐

卫生间,隔断,作者