Daniel
Daniel

Reputation: 2592

How can I use Shaka Player with raw mp4 video data arriving over xhr or websocket?

I know how can I give Shaka Player a file or mpd from the internet to playback.

However, how can I push raw data from client side JavaScript to it? I could not find anything for that, maybe it is not possible?

Upvotes: 1

Views: 1287

Answers (2)

nerkn
nerkn

Reputation: 1980

easiest way would be checking server time-to-time:

setInterval(checkServer, 5000);
function checkServer(){
  fetch('myurl').then(r=>r.json()).then(r=>switch(r.cmd){
     case 'play': player.url = r.url;
     break;
  })
}

server should respond as json {cmd:'play', url:'/video.vp8'}

If you can dig websocket, server can send command.

Upvotes: 0

marom
marom

Reputation: 5230

I would say you can't. When you feed Shaka Player a .mpd file you give the player choose which resolution to use, eventually where to seek etc. All these options imply actions that will be taken by the player, and these actions take the form of a GET requests depending upon what it finds inside the .mpd file.

If you open a websocket and push data all this does not make sense.

Upvotes: 0

Related Questions