Vectorly Upscaler Library

Vectorly Upscaler Library

Class

shakaPlugin

new shakaPlugin(player, config)

Shaka Player Plugin for upscaler. The class is accessible at vectorlyUpscaler.shakaPlugin from vectorly-shaka.js library

Parameters

  • player shaka.Player

    Shaka player instance

  • config vectorlyUpscaler~config

    Configuration for upscaler. Only token is required. See upscaler config for more options

    Properties

    • token string

      required; Token used to fetch models from server; Signup on Upscaler dashboard to get the token

Example

<script src="https://cdn.vectorly.io/upscaler/v2/latest/vectorly-shaka.js"> </script>


<div id="container" data-shaka-player-container style="max-width:1280px;">
   <video data-shaka-player crossorigin="anonymous" id="my-video" ></video>
</div>

<script>
    async function init() {
       const video = document.getElementById('my-video');
       const ui = video['ui'];
       const controls = ui.getControls();
       const player = controls.getPlayer();

       try {
           await player.load(url);
           // This runs if the asynchronous load is successful.
           const upscaler = new vectorlyUpscaler.shakaPlugin(player,{
                token: <your-token>
              });
       } catch (error) {
          console.log(error);
       }
    }

    document.addEventListener('shaka-ui-loaded', init);

</script>

Methods

changeNetwork(networkParams)

async changeNetwork - Change the model network and parameters being used to render

This method is still WIP. Expect some lag when changing the networks

Parameters

disable()

disable - Disables upscaler

enable()

enable - Enables upscaler

on(event, callback)

on - Register event listener

Parameters

  • event string

    Event type string. Can be load, error, start, stop;

  • callback function

    Function to be called on event fired

Example

Add upscaler event listeners to vectorlyUpscaler.shakaPlugin

upscaler
   .on('load', function () {
       console.log("Upscaler initialized"); })
   .on('error', function () {
       console.log("Failed to initialize"); })
   .on('start', function () {
       console.log("Starting upscaling"); })
   .on('stop', function () {
       console.log("Stopping upscaling"); })

Listens to events