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

Unhandled Promise Rejection: [object DOMError] #3

Open
reisraff opened this issue Nov 28, 2019 · 2 comments
Open

Unhandled Promise Rejection: [object DOMError] #3

reisraff opened this issue Nov 28, 2019 · 2 comments

Comments

@reisraff
Copy link

After call player.playMediaUnits(units); we got the exception.

Device: IPhone 5
Browser: Safari 11.0

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Veeplay test</title>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <script src="https://cdn.veeplay.com/veeplay-web/1.1.1/mp.bundle.js"></script>
</head>
<body>

    <div class="container" style="padding-top: 150px">
        <!-- Content here -->
        <div id="player" style="border: 1px solid #000;min-height: 500px;"></div>
    </div>

    <script>
      (async () => {
        try {
          // instantiate main player object
          const player = new MediaPlayer('player');
          // instantiate a MediaBuilder object used for generating MediaUnits for configuring the main content and any abreaks
          const builder = new MediaBuilder(player);

          await builder.configureFromJSON({
            // Main content unit configuration
            "content": [
              {
                "url": "",
                "autoplay": true,
                "controls": {
                }
              }
            ]
          });

          // Retrieve the generated MediaUnits (the main class for encapsulating each piece of content that needs to be played)
          const units = await builder.mediaUnits();

          // Instruct the player to start playback
          player.playMediaUnits(units);
          // player.setMute();
        } catch (error) {
          console.error(error);
        }
      })();
    </script>
</body>
</html>
@ov1d1u
Copy link

ov1d1u commented Dec 2, 2019

Please note that to use "autoplay": true user has to interact with the webpage first or the video should have no audio track or it have to be muted. If you're using the JS library in a WKWebView have a look on the documentation for mediaTypesRequiringUserActionForPlayback property to see what to do to enable autoplay without requiring user interaction.

There was also an issue on iOS which caused the autoplay parameter to be ignored, it was fixed and the fix will be included in the following release, 1.1.1.

@reisraff
Copy link
Author

reisraff commented Dec 2, 2019

I got it, but it should throw a message and not an Exception since it is a framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants