0. 下载nginx(http://nginx.org/)
1. 解压nginx
2. 在windows下运行nginx.exe
3. 把音视频文件,或文档放到html/目录下
Android平台播放视频所额外需要的步骤
4. 写死url
frameworks/av/media/libmediaplayerservice/MediaPlayerService.cpp +673
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -671,12 +671,14 @@ static bool canReusePlayerType(const char* url)
}
status_t MediaPlayerService::Client::setDataSource(
- const char *url, const KeyedVector<String8, String8> *headers)
+ const char *murl, const KeyedVector<String8, String8> *headers)
{
ALOGV("setDataSource(%s)", url);
if (url == NULL)
return UNKNOWN_ERROR;
+ char * url;
+ sprintf(url, "http://192.168.0.240/3.mp4"); //确保服务器地址和android设备地址在同一个局域网内
if ((strncmp(url, "http://", 7) == 0) ||
(strncmp(url, "https://", 8) == 0) ||
(strncmp(url, "rtsp://", 7) == 0)) {
5. 验证--使用vlc播放器 (VLC官网:http://www.videolan.org/)
在vlc播放器网址栏中输入
http://192.168.0.240/3.mp4
6. 在android设备上播放
在浏览器地址栏输入
http://192.168.0.240/3.mp4
PS:如果浏览器只是下载而不是在线播放,则需要修改浏览器app代码,改变浏览器的行为,使之在线播放,而不是下载。
1. 解压nginx
2. 在windows下运行nginx.exe
3. 把音视频文件,或文档放到html/目录下
Android平台播放视频所额外需要的步骤
4. 写死url
frameworks/av/media/libmediaplayerservice/MediaPlayerService.cpp +673
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -671,12 +671,14 @@ static bool canReusePlayerType(const char* url)
}
status_t MediaPlayerService::Client::setDataSource(
- const char *url, const KeyedVector<String8, String8> *headers)
+ const char *murl, const KeyedVector<String8, String8> *headers)
{
ALOGV("setDataSource(%s)", url);
if (url == NULL)
return UNKNOWN_ERROR;
+ char * url;
+ sprintf(url, "http://192.168.0.240/3.mp4"); //确保服务器地址和android设备地址在同一个局域网内
if ((strncmp(url, "http://", 7) == 0) ||
(strncmp(url, "https://", 8) == 0) ||
(strncmp(url, "rtsp://", 7) == 0)) {
5. 验证--使用vlc播放器 (VLC官网:http://www.videolan.org/)
在vlc播放器网址栏中输入
http://192.168.0.240/3.mp4
6. 在android设备上播放
在浏览器地址栏输入
http://192.168.0.240/3.mp4
PS:如果浏览器只是下载而不是在线播放,则需要修改浏览器app代码,改变浏览器的行为,使之在线播放,而不是下载。