# Video Transcode

# Listen Transcoder Websocket Events

When file is uploaded system will run transcoder and you can listen for progress. All data needed for WebSocket are in JSON response when file is uploaded.

# Instructions


In front web application, best way to consume data to use Laravel Echo (opens new window).

Code Example:

const Pusher = require('pusher-js')
let pusher = new Pusher('KEY', {
  cluster: 'CLUSTER'
})

# Event

Web socket sends event objects like this:

{
    "id": 1184,
    "progress": 11
}

PROPERTY TYPE DESCRIPTION
id integer
progress integer From 0 to 100

# Code example of handling websocket events:


let channel = pusher.subscribe(`transcoding_channel_${item.id}`)
    channel.bind('App\\Events\\VideoConversionProgress', data => {
        store.dispatch("videos/setRealtimeProgress", {
        id: item.id,
        progress: data.progress,
    });
});