问题
I am implement html5 player. It is similar to streaming, but it is not strictly streaming.
First I tried. Using Media Source Extensions. But I can not implement seeking. I do not know the byte offset.
So I thought. If you can create an http server in your browser, I can only respond to range requests.
Can I create http server in browser using javascript? It is support mobile/pc browser. It is must support mobile/pc browser.
回答1:
Can I create http server in browser using javascript?
No. Regular browser Javascript cannot create a web server. Browser Javascript was not given that capability and since you cannot create your own TCP server either, you cannot even build your own http server.
To do something like that, you'd have to have a browser extension that used some native code to set up an http server. But, even if you did that, you'd probably have firewall issues since most clients are not directly reachable by other clients unless they happen to be on the same sub-network as clients are usually behind a firewall.
来源:https://stackoverflow.com/questions/46066279/how-to-create-http-server-in-browser-using-javascript