TypeError: e.play is not a function. (In 'e.play()', 'e.play' is undefined) in Safari

Hi,

I’m using the Cloudflare Stream API player and when calling .play() in Safari I’m sometimes getting the following error:

TypeError: e.play is not a function. (In 'e.play()', 'e.play' is undefined)

It seems like it’s happening most of the time when calling .play() too early after loading the page, but I don’t see any event I can use to tell whether Cloudflare is fully ready or not?
Is there a way to detect when Cloudflare is ready, i.e. .play is NOT undefined?

The same code is working every time in Chrome.

Thanks,
Dennis

@MajesticBlvd Thanks for reporting! Would you mind putting together a reduced test case (either on codesandbox or similar) to reproduce the issue? Thanks!

1 Like

Here you go @kkipp:

It’s happening about every other time if you refresh the page (the error will be seen in the Safari web developer console, not CodePen’s).

Thanks!

2 Likes

Thank you! In the meantime, you should be able to listen for the canplay event.

1 Like

Waiting for the canplay event works, thank you @kkipp

@MajesticBlvd this should be fixed now!

4 Likes

This topic was automatically closed after 33 hours. New replies are no longer allowed.