### Play Video Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Use the player.play() method to start video playback. ```javascript player.play(); ``` -------------------------------- ### Create a New Teyuto Player Instance Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Instantiate a new TeyutoPlayer with a target element and configuration options. The 'autoplay' option is set to 'on' in this example. ```javascript let options={ autoplay:'on' }; let player = new TeyutoPlayer("#target", { id: "", options: options }); ``` -------------------------------- ### player.play() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Sends a play command to the embedded iframe player via `postMessage` to start playback. ```APIDOC ## player.play() — Start Playback Sends a play command to the embedded iframe player via `postMessage`. ### Method - `play()` ### Request Example ```javascript document.getElementById('my-play-btn').addEventListener('click', function () { player.play(); }); ``` ``` -------------------------------- ### Programmatically Start Video Playback Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Send a play command to the embedded iframe player via postMessage. This is useful for triggering playback on custom events, such as a button click. ```javascript // Trigger playback programmatically, e.g. on a custom button click document.getElementById('my-play-btn').addEventListener('click', function () { player.play(); }); ``` -------------------------------- ### Get Volume Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Retrieve the current volume level of the player using player.getVulume(). ```javascript player.getVulume(); ``` -------------------------------- ### Get Current Volume with player.getVolume() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Retrieve the current volume level as a float between 0.0 and 1.0. The SDK internally polls for volume changes to keep this value synchronized. ```javascript let vol = player.getVolume(); console.log('Current volume: ' + (vol * 100).toFixed(0) + '%'); // Output: "Current volume: 75%" ``` -------------------------------- ### Get Current Playback Time Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Retrieve the current playback time in seconds using player.getCurrentTime(). ```javascript player.getCurrentTime(); ``` -------------------------------- ### Get Current Video Playback Position Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Retrieve the current playback position in seconds as a number. The SDK internally polls the iframe every second to keep this value synchronized. ```javascript // Display current time in a custom UI element setInterval(function () { let currentTime = player.getCurrentTime(); document.getElementById('time-display').textContent = 'Current time: ' + currentTime.toFixed(1) + 's'; }, 1000); ``` -------------------------------- ### Initialize Teyuto Player with Configuration Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Create a new player instance by providing a CSS selector for the player container, channel token, and video ID. All player behaviors are controlled through the optional 'options' sub-object. ```html
``` -------------------------------- ### Player Initialization Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Instructions on how to include the SDK in your project and initialize a new Teyuto player instance. ```HTML ``` ```JavaScript let options={ autoplay:'on' }; let player = new TeyutoPlayer("#target", { id: "", options: options }); ``` -------------------------------- ### Initialize and Control Teyuto Player Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md This HTML snippet shows how to embed the Teyuto Player SDK, initialize a player instance with custom options, and control video playback through buttons and event listeners. Ensure the SDK script is loaded before initializing the player. ```html
``` -------------------------------- ### Initialize Teyuto Player Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/examples/basic.html Instantiate the Teyuto Player with a target element, channel, ID, and playback options. Ensure the target element exists in the DOM before initialization. ```javascript let options = { autoplay: 'on' }; let player = new TeyutoPlayer("#target", { channel: "30Y8zKKY9H3IUaImUidzCqa5852a1cead3fb2b2ef79cf6baf04909", id: 46760, options: options }); ``` -------------------------------- ### TeyutoPlayer Initialization Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Initializes a new Teyuto player instance by targeting a CSS selector and providing channel and video ID, along with configuration options. ```APIDOC ## new TeyutoPlayer(selector, config) — Initialize the Player Creates a new player instance and injects a responsive or fixed-size iframe into the element matched by `selector`. The `config` object requires a `channel` (your Teyuto channel token) and an `id` (the video ID). All player behavior is controlled through the `options` sub-object. Returns a player instance exposing methods and an event listener interface. ### Parameters #### Path Parameters - **selector** (string) - Required - CSS selector for the target DOM element. - **config** (object) - Required - Configuration object. - **channel** (string) - Required - Your Teyuto channel token. - **id** (number) - Required - The video ID. - **options** (object) - Optional - Player behavior configuration. - **autoplay** (string) - Optional - 'on' | 'off'. - **muted** (string) - Optional - 'on' | 'off'. - **controls** (string) - Optional - 'on' | 'off'. - **playbackRates** (string) - Optional - 'on' | 'off'. - **qualitySelector** (string) - Optional - 'on' | 'off'. - **playerColor** (string) - Optional - HEX color string. - **responsive** (string) - Optional - 'on' | 'off'. - **width** (number) - Optional - Pixels (used when responsive is 'off'). - **height** (number) - Optional - Pixels (used when responsive is 'off'). - **loop** (string) - Optional - 'on' | 'off'. - **captions** (string) - Optional - 'on' | 'off'. - **seekButtons** (string) - Optional - 'on' | 'off'. - **lowLatency** (string) - Optional - 'on' | 'off' — for live streams. - **related** (string) - Optional - 'on' | 'off'. - **relatedTags** (string) - Optional - VAST or VMAP ad tag URL. - **adTag** (string) - Optional - Comma-separated ad tag IDs. - **bigUnmute** (string) - Optional - 'on' | 'off'. - **fullscreenToggle** (string) - Optional - 'on' | 'off'. - **mobileUi** (string) - Optional - 'on' | 'off'. - **skin** (string) - Optional - Player skin name. - **token** (string) - Optional - Access token for protected videos. ### Request Example ```html
``` ``` -------------------------------- ### Player Initialization Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Initializes a new Teyuto Player instance with specified target element, video ID, and player options. ```APIDOC ## Player Initialization ### Description Initializes a new Teyuto Player instance. ### Constructor `new TeyutoPlayer(targetElement, config)` ### Parameters - **targetElement** (string) - The CSS selector for the HTML element where the player will be embedded. - **config** (object) - Configuration object for the player. - **id** (string) - The ID of the video to be played. - **options** (object) - Player customization options. - **autoplay** (string) - 'on' or 'off'. - **muted** (string) - 'on' or 'off'. - **controls** (string) - 'on' or 'off'. - **responsive** (string) - 'on' or 'off'. - **width** (number) - Player width in pixels. - **height** (number) - Player height in pixels. - **playbackRates** (string) - 'on' or 'off'. - **qualitySelector** (string) - 'on' or 'off'. - **playerColor** (string) - Hex color code for the player. - **loop** (string) - 'on' or 'off'. - **captions** (string) - 'on' or 'off'. ### Request Example ```javascript let options = { autoplay: 'on', muted: 'on', controls: 'on', // ... other options }; let player = new TeyutoPlayer("#target", { id: "10912", options: options }); ``` ``` -------------------------------- ### Initialize Teyuto Player Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/examples/full.html Initialize the Teyuto player with specified channel, ID, and various configuration options. Ensure the target element exists on the page. ```javascript let options = { autoplay: 'on', muted: 'on', controls: 'on', responsive: 'off', width: 560, height: 300, playbackRates: 'on', qualitySelector: 'on', playerColor: '#dddddd', loop: 'off', captions: 'on' }; let player = new TeyutoPlayer("#target", { channel: "30Y8zKKY9H3IUaImUidzCqa5852a1cead3fb2b2ef79cf6baf04909", id: 46760, options: options }); ``` -------------------------------- ### Complete Teyuto Player Integration Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt This HTML structure includes the Teyuto Player SDK script, basic styling, a player container, control buttons, and a status display. It demonstrates player initialization with options and event handling for playback status. ```html
Waiting for events…
``` -------------------------------- ### Player Methods Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Available methods for controlling the Teyuto player after initialization. ```APIDOC ## Methods * player.play(); * player.pause(); * player.getCurrentTime(); * player.setCurrentTime(10); //in seconds * player.mute(); * player.unmute(); * player.getVulume(); * player.setVolume(1); //from 0 to 1 ``` -------------------------------- ### Include Teyuto Player SDK in HTML Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Include the SDK script in the head of your HTML file for simple integration. ```html ``` -------------------------------- ### Player Options Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md A list of available option parameters for configuring the Teyuto player. ```APIDOC ## Option Parameters | **Variable** | **Options** | **Others** | | --------------- | ------------------------------------------------- | ------------------------------------------------------------------------- | | autoplay | 'on' , 'off' *String* | 'on' *default* | | muted | 'on' , 'off' *String* | 'off' *default* | | controls | 'on' , 'off' *String* | 'on' *default* | | playbackRates | 'on' , 'off' *String* | 'on' *default* | | qualitySelector | 'on' , 'off' *String* | 'on' *default* | | playerColor | HEX color *String* | '#dddddd' *default* | | responsive | 'on' , 'off' *String* | 'on' *default* *if responsive is 'on', height and width are not used* | | width | pixels The width in pixels (e.g. width="100") | 560 *default* | | height | pixels The width in pixels (e.g. width="100") | 315 *default* | | loop | 'on' , 'off' *String* | 'off' *default* | | captions | 'on' , 'off' *String* | 'on' *default* | | seekButtons | 'on' , 'off' *String* | 'on' *default* | | chromecast | 'on' , 'off' *String* | 'on' *default* | | airPlay | 'on' , 'off' *String* | 'on' *default* | | seekButtons | 'on' , 'off' *String* | 'on' *default* | lowLatency | 'on' , 'off' *String* | 'off' *default* | related | 'on' , 'off' *String* | 'off' *default* | relatedTags | 'vast or vmap url' *String* | '' *default* | adTag | '1,2,3,4,...' *String* | '' *default* | token | *String* | '' *default* | bigUnmute | 'on' , 'off' *String* | 'off' *default vod* / 'on' *default live* ``` -------------------------------- ### Player Control Methods Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Methods to control video playback, volume, and time. ```APIDOC ## Player Control Methods ### Playback Control - **play()** - **Description**: Starts or resumes video playback. - **Method**: `player.play()` - **pause()** - **Description**: Pauses the video playback. - **Method**: `player.pause()` ### Volume Control - **setVolume(level)** - **Description**: Sets the player's volume level. - **Method**: `player.setVolume(level)` - **Parameters**: - **level** (number) - The desired volume level, from 0.0 to 1.0. - **getVolume()** - **Description**: Retrieves the current volume level of the player. - **Method**: `player.getVolume()` - **Returns**: (number) - The current volume level. ### Time Control - **setCurrentTime(time)** - **Description**: Seeks to a specific point in the video. - **Method**: `player.setCurrentTime(time)` - **Parameters**: - **time** (number) - The time in seconds to seek to. - **getCurrentTime()** - **Description**: Retrieves the current playback time of the video. - **Method**: `player.getCurrentTime()` - **Returns**: (number) - The current playback time in seconds. ``` -------------------------------- ### Event Handling Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Methods for subscribing to and handling player events. ```APIDOC ## Event Handling ### on(eventName, callback) - **Description**: Attaches an event listener to the player. - **Method**: `player.on(eventName, callback)` ### Parameters - **eventName** (string) - The name of the event to listen for (e.g., 'play', 'pause'). - **callback** (function) - The function to execute when the event is triggered. - The callback function receives an event object `e` as an argument. - `e.detail` contains the player instance. ### Request Example ```javascript player.on('play', function(e) { console.log('play event received', e.detail); }); player.on('pause', function(e) { console.log('pause event received', e.detail); }); ``` ``` -------------------------------- ### player.setCurrentTime(seconds) Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Seeks the video to the specified position in seconds. ```APIDOC ## `player.setCurrentTime(seconds)` — Seek to Position Seeks the video to the specified position in seconds. ### Parameters #### Path Parameters - **seconds** (number) - Required - The time in seconds to seek to. ### Request Example ```javascript // Skip to the 2-minute mark player.setCurrentTime(120); // Jump forward 30 seconds from current position let jumpForward30 = function () { let current = player.getCurrentTime(); player.setCurrentTime(current + 30); }; document.getElementById('skip-btn').addEventListener('click', jumpForward30); ``` ``` -------------------------------- ### Handle Player Events Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/examples/full.html Listen for and handle player events such as 'play' and 'pause'. The event detail object contains the player instance. ```javascript //Events player.on('play', function (e) { // e.detail is the player console.log('play event received', e.detail); }); player.on('pause', function (e) { // e.detail is the player console.log('pause event received', e.detail); }); ``` -------------------------------- ### Subscribe to Player Events with player.on() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Use `player.on()` to attach event listeners for various player states and actions. The callback receives a `CustomEvent` with a `detail` object containing event-specific information. Supports standard media events and Teyuto-specific events. ```javascript // Comprehensive event handling example player.on('play', function (e) { console.log('Playback started', e.detail); // e.detail => { idVideo: 46760, type: 'play', values: ..., data: ... } }); player.on('pause', function (e) { console.log('Playback paused at', player.getCurrentTime(), 's'); }); player.on('ended', function (e) { console.log('Video finished — showing replay button'); document.getElementById('replay-btn').style.display = 'block'; }); player.on('timeupdate', function (e) { // Fires frequently during playback — use for progress bar updates let pct = (player.getCurrentTime() / totalDuration) * 100; document.getElementById('progress-bar').style.width = pct + '%'; }); player.on('error', function (e) { console.error('Player error:', e.detail); }); player.on('volumechange', function (e) { console.log('Volume changed to:', player.getVolume()); }); player.on('fullscreenchange', function (e) { console.log('Fullscreen toggled', e.detail); }); ``` -------------------------------- ### player.getVolume() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Returns the current volume as a number between 0 (silent) and 1 (full volume). ```APIDOC ## `player.getVolume()` — Get Current Volume Returns the current volume as a number between `0` (silent) and `1` (full volume). The value is kept in sync via internal `postMessage` polling. ### Response #### Success Response (200) - **volume** (number) - The current volume level, between 0.0 and 1.0. ### Request Example ```javascript let vol = player.getVolume(); console.log('Current volume: ' + (vol * 100).toFixed(0) + '%'); // Output: "Current volume: 75%" ``` ``` -------------------------------- ### Set Player Volume with player.setVolume() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Adjust the player's volume using `setVolume()`, providing a level between 0.0 (silent) and 1.0 (full volume). This method is useful for volume slider integrations and setting predefined volume levels. ```javascript // Volume slider integration document.getElementById('volume-slider').addEventListener('input', function (e) { let level = parseFloat(e.target.value); // expects 0.0 – 1.0 player.setVolume(level); console.log('Volume set to:', level); }); // Common presets player.setVolume(0); // effectively mutes player.setVolume(0.5); // 50% player.setVolume(1); // full volume ``` -------------------------------- ### player.on(eventName, callback) Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Registers an event listener on the player's container element. The callback receives a CustomEvent. ```APIDOC ## `player.on(eventName, callback)` — Subscribe to Player Events Registers an event listener on the player's container element. The callback receives a `CustomEvent` whose `detail` object contains `{ idVideo, type, values, data }`. Supports all standard HTML media events plus Teyuto-specific ones. **Available events:** `play`, `pause`, `ended`, `timeupdate`, `volumechange`, `seeking`, `seeked`, `canplay`, `playing`, `waiting`, `loadstart`, `suspend`, `abort`, `error`, `stalled`, `durationchange`, `ratechange`, `resize`, `fullscreenchange`, `useractive`, `userinactive` ### Parameters #### Path Parameters - **eventName** (string) - Required - The name of the event to listen for. - **callback** (function) - Required - The function to execute when the event is triggered. ### Request Example ```javascript // Comprehensive event handling example player.on('play', function (e) { console.log('Playback started', e.detail); // e.detail => { idVideo: 46760, type: 'play', values: ..., data: ... } }); player.on('pause', function (e) { console.log('Playback paused at', player.getCurrentTime(), 's'); }); player.on('ended', function (e) { console.log('Video finished — showing replay button'); document.getElementById('replay-btn').style.display = 'block'; }); player.on('timeupdate', function (e) { // Fires frequently during playback — use for progress bar updates let pct = (player.getCurrentTime() / totalDuration) * 100; document.getElementById('progress-bar').style.width = pct + '%'; }); player.on('error', function (e) { console.error('Player error:', e.detail); }); player.on('volumechange', function (e) { console.log('Volume changed to:', player.getVolume()); }); player.on('fullscreenchange', function (e) { console.log('Fullscreen toggled', e.detail); }); ``` ``` -------------------------------- ### player.pause() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Sends a pause command to the embedded iframe player via `postMessage` to pause playback. ```APIDOC ## player.pause() — Pause Playback Sends a pause command to the embedded iframe player via `postMessage`. ### Method - `pause()` ### Request Example ```javascript setTimeout(function () { player.pause(); console.log('Video paused at 10s'); }, 10000); ``` ``` -------------------------------- ### Set Volume Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Set the player's volume level using player.setVolume(level), where level is a float between 0 and 1. ```javascript player.setVolume(1); ``` -------------------------------- ### Seek to Position with player.setCurrentTime() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Use `setCurrentTime` to jump to a specific time in seconds. It can be used to seek to an absolute position or relative to the current playback time. ```javascript // Skip to the 2-minute mark player.setCurrentTime(120); // Jump forward 30 seconds from current position let jumpForward30 = function () { let current = player.getCurrentTime(); player.setCurrentTime(current + 30); }; document.getElementById('skip-btn').addEventListener('click', jumpForward30); ``` -------------------------------- ### player.setVolume(level) Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Sets the player volume to a value between 0.0 (silent) and 1.0 (full volume). ```APIDOC ## `player.setVolume(level)` — Set Volume Sets the player volume to a value between `0.0` (silent) and `1.0` (full volume). ### Parameters #### Path Parameters - **level** (number) - Required - The desired volume level, between 0.0 and 1.0. ### Request Example ```javascript // Volume slider integration document.getElementById('volume-slider').addEventListener('input', function (e) { let level = parseFloat(e.target.value); // expects 0.0 – 1.0 player.setVolume(level); console.log('Volume set to:', level); }); // Common presets player.setVolume(0); // effectively mutes player.setVolume(0.5); // 50% player.setVolume(1); // full volume ``` ``` -------------------------------- ### Pause Video Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Use the player.pause() method to pause video playback. ```javascript player.pause(); ``` -------------------------------- ### Set Current Playback Time Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Set the video playback to a specific time in seconds using player.setCurrentTime(seconds). ```javascript player.setCurrentTime(10); ``` -------------------------------- ### player.mute() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Mutes the player audio without changing the volume level. ```APIDOC ## `player.mute()` — Mute Audio Mutes the player audio without changing the volume level. ### Request Example ```javascript // Mute the player when the page loses focus window.addEventListener('blur', function () { player.mute(); }); ``` ``` -------------------------------- ### player.getCurrentTime() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Retrieves the current playback position in seconds as a number. This value is updated periodically. ```APIDOC ## player.getCurrentTime() — Get Current Playback Position Returns the current playback position in seconds as a number. The value is kept in sync with the iframe via a polling `postMessage` exchange that runs every 1 second internally. ### Method - `getCurrentTime()` ### Response - **currentTime** (number) - The current playback position in seconds. ### Request Example ```javascript setInterval(function () { let currentTime = player.getCurrentTime(); document.getElementById('time-display').textContent = 'Current time: ' + currentTime.toFixed(1) + 's'; }, 1000); ``` ``` -------------------------------- ### Programmatically Pause Video Playback Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Send a pause command to the embedded iframe player via postMessage. This can be used to pause the video at specific times or in response to certain conditions. ```javascript // Pause the video after 10 seconds using a timer setTimeout(function () { player.pause(); console.log('Video paused at 10s'); }, 10000); ``` -------------------------------- ### player.unmute() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Restores audio after muting. ```APIDOC ## `player.unmute()` — Unmute Audio Restores audio after muting. ### Request Example ```javascript // Unmute when the page regains focus window.addEventListener('focus', function () { player.unmute(); }); ``` ``` -------------------------------- ### Unmute Audio with player.unmute() Source: https://context7.com/teyuto/teyuto-player-sdk/llms.txt Use `unmute()` to restore audio after it has been muted. This is typically paired with an event listener for when the page regains focus. ```javascript // Unmute when the page regains focus window.addEventListener('focus', function () { player.unmute(); }); ``` -------------------------------- ### Mute Audio Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Mute the player's audio using the player.mute() method. ```javascript player.mute(); ``` -------------------------------- ### Unmute Audio Source: https://github.com/teyuto/teyuto-player-sdk/blob/production/README.md Unmute the player's audio using the player.unmute() method. ```javascript player.unmute(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.