HttpServer httpServer = await HttpServer.bind("localhost", 45678);
File file = File("C:/Users/19519/Desktop/videos/bg2.mp4");
await for(HttpRequest httpRequest in httpServer){
httpRequest.response
..headers.add("Content-Type", "video/mp4") /// 添加响应行
..write(String.fromCharCodes(file.readAsBytesSync())) /// String.fromCharCodes 不用的话返回的及时int的list [...]
..close();
}
标签:httpRequest,httpServer,..,fromCharCodes,dart,mp4,video,服务器返回
From: https://www.cnblogs.com/sqmw/p/17062313.html