M3U8 Player Online

API Reference

Detailed documentation for developers integrating with M3U8 Player Online

API Overview

M3U8 Player Online provides several ways to integrate with your website or application:

  • Embed API: Embed the player in your website using an iframe with customization options.
  • Player API: Control the player programmatically using JavaScript.
  • Events: Listen to player events to create interactive experiences.

Getting Started

To get started with the M3U8 Player Online API, you first need to embed the player in your website. You can then access the player instance to control it programmatically.

<!-- Embed the player -->
<iframe 
  src="https://www.m3u8player.online/embed/m3u8?url=YOUR_STREAM_URL" 
  width="100%" 
  height="100%" 
  style="border:none; aspect-ratio: 16/9;" 
  allowfullscreen
></iframe>

<!-- Access the player API -->
<script>
  window.addEventListener('message', (event) => {
    if (event.origin !== 'https://www.m3u8player.online') return;
    
    if (event.data.type === 'playerReady') {
      // Player is ready, you can now control it
      const iframe = document.querySelector('iframe');
      
      // Example: Play a different stream
      iframe.contentWindow.postMessage({
        type: 'loadUrl',
        url: 'https://example.com/stream.m3u8'
      }, 'https://www.m3u8player.online');
    }
  });
</script>