Basic Usage

1. Basic Usage Demo

2. Example Code

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" charset="utf-8" src="https://cdn.zwplayer.com/v3/zwplayer/zwplayer.js"></script>
</head>
<body>
<div id="mse" style="width: 800px; aspect-ratio: 16/9; margin: 0 auto;"></div>
<script type="text/javascript">
    var info = {
        playerElm: 'mse',
        url: 'https://d2zihajmogu5jn.cloudfront.net/elephantsdream/ed_hd.mp4',
        infoButton: true,
        optionButton: true,
        snapshotButton: true,
        controlbar: true,
        autoplay: true,
        fluid: true,
        ratio: "16:9",
    };
    new ZWPlayer(info);
</script>
</body>
</html>

3. Configuration Parameter Description

Parameter Type Default Description
playerElm String or Element - Player container element or selector
url String or Object - URL address of the video file
infoButton Boolean false Whether to show the video info button
optionButton Boolean false Whether to show the video options button
snapshotButton Boolean false Whether to show the video snapshot button
controlbar Boolean true Whether to show the video control bar
autoplay Boolean true Whether to autoplay the video
fluid Boolean false Whether to enable fluid layout
ratio String “16:9” Video aspect ratio, e.g. “16:9” or “4:3”