Handling media files
HTML5 APIs provide a simple way to handle media files such as audio and video. The API implementation is really easy:
<video width="400" controls> <source src="video.ogv" type="video/ogg"> </video> <audio controls> <source src="audio.ogg" type="audio/ogg"> </audio>
Between the supported file formats, you can find ogg
, ogv
, and wav
. The codecs included in the pre-built ffmpegsumo
library are Cotheora, vorbis, vp8, pcm_u8, pcm_s16le, pcm_s24le, pcm_f32le, pcm_s16be and pcm_s24be.
As you have probably already figured out, you're not allowed to play mp3
and mpeg4
files natively as their codecs are proprietary. Unfortunately, there's no easy workaround for the issue. Someone has successfully used the media libraries from Chrome, but I couldn't replicate the process on NW.js 0.11.5. The best way to give support for these codecs to your application is to compile ffmpeg
with the corresponding options, but bear in mind that the MP3 and H.264...