npm.io
0.1.2 • Published 8 months ago

tiktok-video-element

Licence
MIT
Version
0.1.2
Deps
0
Size
41 kB
Vulns
0
Weekly
0
Stars
263

<tiktok-video>

NPM Version NPM Downloads jsDelivr hits (npm) npm bundle size

A custom element for the TikTok player with an API that matches the <video> API.

Example

<script type="module" src="https://cdn.jsdelivr.net/npm/tiktok-video-element@0"></script>
<tiktok-video controls src="https://www.tiktok.com/@wesbos/video/6718335390845095173"></tiktok-video>

Installing

<tiktok-video> is packaged as a javascript module (es6) only, which is supported by all evergreen browsers and Node v12+.

Loading into your HTML using <script>

Note the type="module", that's important.

Modules are always loaded asynchronously by the browser, so it's ok to load them in the head , and best for registering web components quickly.

<head>
  <script type="module" src="https://cdn.jsdelivr.net/npm/tiktok-video-element@0"></script>
</head>
Adding to your app via npm
npm install tiktok-video-element --save

Or yarn

yarn add tiktok-video-element

Include in your app javascript (e.g. src/App.js)

import 'tiktok-video-element';

This will register the custom elements with the browser so they can be used as HTML.

Keywords