How to stream .avi film files with node.JS? (File opens download screen instead of streamed)

前端 未结 1 1097
南方客
南方客 2020-12-20 02:24

I\'m using vid-streamer https://github.com/meloncholy/vid-streamer.

  1. To install just create a folder on your pc
  2. open terminal and do CD to folder
相关标签:
1条回答
  • 2020-12-20 03:01

    First of all, you should know that browsers are not video players so you can not expect that a browser can play any format of videos !

    In addition, not all video formats are suitable for the web for many reasons, so try always to take this point on consideration when you want stream videos, and think how to make your video suitable for the web and not how to make web suitable to your video ( like your question ;) ).

    Recent browsers can support natively some video formats like MP4, WEBM and OGG which will be played using the HTML5 <video> element, in the case where a video format is not natively supported, the browser will try to play it with a plugin like VLC Web Plugin, QuickTime, Osmozilla - GPAC Plugin, ... otherwise ( there are no suitable plugin ), the browser will simply download the file (or open it with the associated application after asking user).

    So to "resolve your problem", I think that you have 2 choices :

    • Convert your videos to natively supported formats.
    • Force users to get the suitable plugins for your videos, which is technically impossible.

    For more informations about all that and more, you can take a look on these links :

    • Mozilla Developer Network : Media formats supported by the HTML audio and video elements.
    • The Chromium Projects : Everything you need to know about audio/video inside Chromium.
    • Wikipedia : HTML5 video.
    • caniuse.com : MPEG-4/H.264 video format ( see also the Resources tab at the bottom ).
    • caniuse.com : WebM video format ( see also the Resources tab at the bottom ).
    • caniuse.com : Ogg/Theora video format ( see also the Resources tab at the bottom ).
    • Microsoft Developer Network : How to use HTML5 to play video files on your webpage.
    • Dev.Opera : Introduction to HTML5 Video.

    Of course here I tried just to give you a short "answer" to your question about playing video directly in the browser ( without HTML ), and I think after this, you will surely think to play your videos in HTML pages, you can also find an answer for that in the links above.

    Hope all that can help.

    0 讨论(0)
提交回复
热议问题