inline-player.mdx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. title: Inline player
  3. libs: plyr
  4. summary: A simple, lightweight, accessible and customizable HTML5, YouTube and Vimeo media player that supports modern browsers.
  5. description: Lightweight media player for websites.
  6. ---
  7. ## Overview
  8. The Inline Player is a versatile, modern media player designed for seamless integration into websites. It supports HTML5, YouTube, and Vimeo content, offering a lightweight and accessible solution for media playback. Built with customization and ease of use in mind, this player ensures compatibility with modern browsers and enhances user experience.
  9. ## Installation
  10. To use the Inline Player, you need to include the Plyr library in your project. You can install it via npm or include it directly from a CDN. The following example demonstrates how to include the Plyr library from a CDN:
  11. ```html
  12. <script src="$TABLER_CDN/dist/libs/plyr/dist/plyr.min.js"></script>
  13. ```
  14. ## Sample demo
  15. Integrating the Inline Player into your website is straightforward. Below is a sample implementation for a YouTube video:
  16. ```html
  17. <div id="player-youtube" data-plyr-provider="youtube" data-plyr-embed-id="dQw4w9WgXcQ"></div>
  18. <script>
  19. document.addEventListener("DOMContentLoaded", function() {
  20. window.Plyr && (new Plyr('#player-youtube'));
  21. });
  22. </script>
  23. ```
  24. Look at the example below to see how the Inline Player works with a YouTube video.
  25. ```html example vendors height="500px" libs="plyr"
  26. <div id="player-youtube" data-plyr-provider="youtube" data-plyr-embed-id="dQw4w9WgXcQ"></div>
  27. <script src="$TABLER_CDN/dist/libs/plyr/dist/plyr.min.js"></script>
  28. <script>
  29. document.addEventListener("DOMContentLoaded", function() {
  30. window.Plyr && (new Plyr('#player-youtube'));
  31. });
  32. </script>
  33. ```
  34. ## Vimeo file
  35. Here’s how to embed a Vimeo video using the Inline Player:
  36. ```html example vendors height="500px" libs="plyr"
  37. <div id="player-vimeo" data-plyr-provider="vimeo" data-plyr-embed-id="515937365"></div>
  38. <script src="$TABLER_CDN/dist/libs/plyr/dist/plyr.min.js"></script>
  39. <script>
  40. document.addEventListener("DOMContentLoaded", function() {
  41. window.Plyr && (new Plyr('#player-vimeo'));
  42. });
  43. </script>
  44. ```