发帖
9 0 0

小安派BW21-CVB使用http求助

signal
中级会员

1

主题

7

回帖

234

积分

中级会员

积分
234
小安派·BW21-CBV-KIt 113 9 4 天前
如何使用小安派BW21-CVB-DEV实现通过http播放SD卡中的视频,让远程的手机可以在线观看?
──── 0人觉得很赞 ────

使用道具 举报

这个涉及到一个公网IP的问题,你看看内网穿透的教程,需要服务器
内网做一个反向代理指向你的服务
3 天前
Ai-Thinker小泽 发表于 2025-2-24 17:19
这个涉及到一个公网IP的问题,你看看内网穿透的教程,需要服务器

远程手机指的就是开发板自己作为AP发出的wifi信号连接的手机,已经在同一个网段了
signal 发表于 2025-2-25 08:37
远程手机指的就是开发板自己作为AP发出的wifi信号连接的手机,已经在同一个网段了 ...

内网的话就直接把bw21配置成web server?手机直接访问IP
3 天前
1055173307 发表于 2025-2-25 10:52
内网的话就直接把bw21配置成web server?手机直接访问IP

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

开发问题的话,得自己研究研究了,可以借助deepseek。
3 天前
爱笑 发表于 2025-2-25 13:49
开发问题的话,得自己研究研究了,可以借助deepseek。

好的,感谢
3 天前
好像知道问题在哪了,"<source src=\'" + String(path)+ "\' type=\'video/mp4\'>"中的String(path)不能获取到SD卡中的MP4
文件地址,有大佬知道怎么解决吗?
signal 发表于 2025-2-25 14:49
好像知道问题在哪了,""中的String(path)不能获取到SD卡中的MP4
文件地址,有大佬知道怎么解决吗? ...

https://fcniufr8ibx1.feishu.cn/wiki/YUwbwPSTmiGsomkicyOcno2pnni
您需要登录后才可以回帖 立即登录
高级模式
返回
统计信息
  • 会员数: 27954 个
  • 话题数: 39412 篇