应该是的,现在的问题是我直接配置成web serve,往client发送数据不能够直接展示/下载,输入网址是能够显示视频框的,但是不显示视频,对http这边不是很熟悉。  代码如下:
- if (client.available()) { // if there's bytes to read from the client,
- char c = client.read(); // read a byte, then
- Serial.write(c); // print it out the serial monitor
- if (c == '\n') { // if the byte is a newline character
- // if the current line is blank, you got two newline characters in a row.
- // that's the end of the client HTTP request, so send a response:
- if (currentLine.length() == 0) {
- // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
- // and a content-type so the client knows what's coming, then a blank line:
- client.println("HTTP/1.1 200 OK");
- client.println("Content-type:text/html");
- client.println("Connection:keep-alive")
- client.println();
- // send a standard http response header
- client.println("<!DOCTYPE html>");
- client.println("<html>");
- client.println("<body>");
- client.println("<video width=\'320\' height=\'240\' controls>");
- client.println("<source src=\'" + String(path)+ "\' type=\'video/mp4\'>");
- Serial.println("<source src="" + String(path)+ "" type="video/mp4">");
- client.println("</video>");
- client.println("<a href=\'" + String(path) + "\' download>down</a>");
- Serial.println("<a href="" + String(path) + "" download>down</a>");
- client.println("</body>");
- client.println("</html>");
- client.println();
- break;
- } else {
- currentLine = "";
- }
- } else if (c != '\r') {
- currentLine += c;
- }
- }
复制代码 |