Closed KunMengcode closed 2 months ago
WebSocket IOLoader is not yet implemented. You can refer to FileIOLoader to implement it. I think the size method and seek method of WebSocket IOLoader is not universal method.
I had implemented CustomIOLoader for custom data input.
class MyIOLoader extends AVPlayer.IOLoader.CustomIOLoader {
constructor(ws) {
super()
this.ws = ws
}
get ext() {
return 'h265'
}
get name() {
return this.ws
}
async open() {
// open websocket
}
async read(buffer, options) {
// write data to buffer
}
async seek(pos, options) {
// seek if can
}
async size() {
// return total size if has
}
async stop() {
// stop ioloader
}
}
const player = new AVPlayer();
await player.load(new MyIOLoader('wss://xxxx'));
await player.play();
Yes, I also believe that WebSocket IOLoader is not a universal method. I saw in Readme that WebSocket was mentioned, and I was very confused about how WebSocket IOLoader responds to complex requirements.
I am indeed something I overlooked( CustomIOLoader ),For WebSocket, Customizing IOLoader is indeed a good choice.
When I couldn't find any content related to Websocket, I started modifying HlsILOoader.ts
but didn't find Customizing IOLoader. ts, which is really a stupid question
Thank you for the prompt.
I have a WebSocket interface that transmits H265 raw streams internally. I tried to search for the WebSocket footprint but couldn't find it. Did I overlook something?