Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tiktok-video-element

muxinc197.5kMIT0.1.1TypeScript support: included

Custom element (web component) for the TikTok player.

tiktok, video, player, web component, custom element

readme

<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 :thumbsup:, 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.