leiwenge 2023-02-22 23:46 采纳率: 0%
浏览 62
已结题

Destoon 程序做的网站,视频模块无法播放 flv 和 mp4 格式文件,如何解决?

1、宝塔面板 Nginx-1.22.1 版服务器安装了支持视频播放的 nginx_http_flv_module 模块并测试成功,且根据网上查询的资料修改了 nginx.conf 配置文件,Nginx 也重新载入了,也重启了服务器;

2、PHP-7.2.33 版本也安装了 fileinfo 扩展并启用,重新载入并重启过;

3、Destoon B2B 程序网站视频文件网址路径正确,复制到浏览器可下载视频,就是不能播放,在电脑本地可用播放器播放,证明文件没坏,编码正确。

4、视频更新了缓存,浏览器也清除了缓存。flv 和 mp4 两种格式的视频文件始终不能播放,不知问题出在哪里,希望各位工程师能帮我解决这个问题,谢谢!

5、这个是配置文件在服务器上的路径:/www/server/nginx/src/conf/nginx.conf 我只要求能播放视频,并不需要推流、拉流等直播功能;

6、根据 ChatGPT 的聊天问答提示在 /www/server/nginx/conf/nginx.conf 这个文件加入过如下代码:

```bash


types {
video/mp4 mp4;
video/x-flv flv;
}




但提示错误,无法保存文件,最终放弃。

/www/server/nginx/conf/nginx.conf 这个配置文件的全部内容如下:


```bash
user  www www;
worker_processes auto;
error_log  /www/wwwlogs/nginx_error.log  crit;
pid        /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

stream {
    log_format tcp_format '$time_local|$remote_addr|$protocol|$status|$bytes_sent|$bytes_received|$session_time|$upstream_addr|$upstream_bytes_sent|$upstream_bytes_received|$upstream_connect_time';
  
    access_log /www/wwwlogs/tcp-access.log tcp_format;
    error_log /www/wwwlogs/tcp-error.log;
    include /www/server/panel/vhost/nginx/tcp/*.conf;
}

events
    {
        use epoll;
        worker_connections 51200;
        multi_accept on;
    }

http
    {
        include       mime.types;
        #include luawaf.conf;

        include proxy.conf;

        default_type  application/octet-stream;

        server_names_hash_bucket_size 512;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;

        tcp_nodelay on;

        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;
            fastcgi_intercept_errors on;

        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
        gzip_vary on;
        gzip_proxied   expired no-cache no-store private auth;
        gzip_disable   "MSIE [1-6]\.";

        limit_conn_zone $binary_remote_addr zone=perip:10m;
            limit_conn_zone $server_name zone=perserver:10m;

        server_tokens off;
        access_log off;
        
server
    {
        listen 888;
        server_name phpmyadmin;
        index index.html index.htm index.php;
        root  /www/server/phpmyadmin;
            location ~ /tmp/ {
                return 403;
            }

        #error_page   404   /404.html;
        include enable-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /www/wwwlogs/access.log;
    }
include /www/server/panel/vhost/nginx/*.conf;
}



7/www/server/nginx/src/conf/nginx.conf 配置文件内容如下:
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

rtmp {
    out_queue           4096;
    out_cork            8;
    max_streams         128;
    timeout             15s;
    drop_idle_publisher 15s;
    
    log_interval 5s; #log 模块在 access.log 中记录日志的间隔时间,对调试非常有用
    log_size     1m; #log 模块用来记录日志的缓冲区大小

     server {
        listen 7933;
        
        application myapp {
            live on;
        }
       application hls {
            live on;
            hls on;
            hls_path /tmp/hls;
        }
        
        application dash {
            live on;
            dash on;
            dash_path /tmp/dash;
        }
    }

}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    flv_live_stream on;
    flv_stream_copy_audio on;
    flv_stream_copy_video on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            add_header 'Access-Control-Allow-Origin' '*';
            root   html;
            index  index.html index.htm;
        }

        location /live {
            flv_live on;
            chunked_transfer_encoding on; #支持'Transfer-Encoding: chunked'方式回复 
            add_header 'Access-Control-Allow-Origin' '*'; #添加额外的 HTTP 头
            add_header 'Access-Control-Allow-Credentials' 'true'; #添加额外的 HTTP 头      
         }

        location /flv {
            add_header 'Access-Control-Allow-Origin' '*';
            flv_live on;
            chunked_transfer_encoding on;
        }

    # control控制器
    location /control {
        rtmp_control all;
    }
        location /stat {
            #推流播放和录制统计数据的配置
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
         }
         location /stat.xsl {
             root /usr/local/nginx-http-flv-module/; #指定 stat.xsl 的位置
         }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
types {
    video/mp4 mp4;
    video/x-flv flv;
}
}

```

  • 写回答

5条回答 默认 最新

  • 特创数字科技 阿克苏市特创数字科技中心官方账号 2023-02-23 00:49
    关注

    可以使用支持 FLV 和 MP4 格式文件的插件,比如 Flowplayer 或者 JWPlayer。在安装这些插件之前,你还要检查 DesToon 当前的服务器是否已经安装了 Adobe Flash Player,以及网站服务器的配置文件是否支持 FLV 和 MP4 格式文件。安装上这类插件以后,通过修改网站的模板源代码来调用这些插件,以实现比较完美地播放 FLV 和 MP4 格式文件的功能。

    评论

报告相同问题?

问题事件

  • 系统已结题 3月2日
  • 修改了问题 2月23日
  • 修改了问题 2月23日
  • 创建了问题 2月22日

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line