Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chromium Embedded Framework MP3 support

I've downloaded Chromium Embedded Framework r306 for Windows and built it. Unfortunately, it shows, that it doesn't support mp3:

<script>
var a = document.createElement("audio");
document.write(a.canPlayType('audio/mpeg'));
</script>

Output is empty and when I try to open an mp3 file, it can't be played (ogg is playable).

The same time Google Chrome writes "maybe" (and it actually plays).

How can I add support for MP3 in CEF?

like image 884
noober Avatar asked Nov 07 '11 06:11

noober


People also ask

Does Chromium support MP3?

Chromium, the skeletal open-source browser at the core of Chrome, Opera, Vivaldi, Brave and a few other browsers will receive support for the automatic playback of MP3 files.

Does electron use chromium embedded framework?

Each window in Electron app represents a Chromium window that renders specific web page or HTML. The GUI of Electron apps is built using HTML, CSS, and JavaScript.


4 Answers

the options to enable proprietary codecs (i.e. H.264 and MP3) have been moved since the last answer.

you can read my answer with all the details on how to compile CEF with enabled proprietary codecs

the magic now happens here:

set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome

there is 2 batch files that you should update/create (as found here):

c:\code\chromium_git\update.bat:

set CEF_USE_GN=1
set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
python ..\automate\automate-git.py --download-dir=C:\code\chromium_git --depot-tools-dir=C:\code\depot_tools --no-distrib --no-build

c:\code\chromium_git\chromium\src\cef\create.bat:

set CEF_USE_GN=1
set GN_DEFINES=is_win_fastlink=true proprietary_codecs=true ffmpeg_branding=Chrome
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
call cef_create_projects.bat

There is 2 wiki articles that explain how to build CEF/Chromium:

  1. https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart.md
  2. and BranchesAndBuilding in the same wiki
like image 135
Eugen Avatar answered Dec 21 '22 16:12

Eugen


Marshall Greenblatt (the maintainer of the Chromium Embedded Framework) addresses the lack of support for MP3 (and AAC) in Chromium and CEF in this bug report (see comment #7, copied below):

Codecs like MP3 and AAC are included in Google Chrome releases but not Chromium builds. This is because these formats are not open and require licensing. Distributing these codecs with your application without a licensing agreement may violate the law in certain countries. You should discuss with a lawyer if appropriate.

like image 39
Emerick Rogul Avatar answered Dec 21 '22 16:12

Emerick Rogul


NOTE: PLEASE CONSIDER LEGAL ISSUES BEFORE PROCEEDING

There is a way to enable MP3 support in CEF, but you'll have to modify the cef.gypi in the source distribution, regenerate the visual studio projects and rebuild.

Step by step instructions:

enter image description here enter image description here aenter image description here enter image description here aenter image description here enter image description here

like image 22
null1941 Avatar answered Dec 21 '22 15:12

null1941


There is a way to enable MP3 support in CEF, but you'll have to modify the cef.gypi in the source distribution, regenerate the visual studio projects and rebuild.

Detailed build instructions:
https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding

Enabling proprietary codecs support:
http://code.google.com/p/chromiumembedded/issues/detail?id=371

Add 'proprietary_codecs': 1 to your cef.gypi configuration so that USE_PROPRIETARY_CODECS will be defined as required by net/base/mime_util.cc.

You'll also need proper builds of the avcodec, avformat and avutil DLLs. Luckily, you can just get these from the installation directory of Google Chrome itself ($User/AppData/Local/Google/Chrome/$Version).

like image 38
zah Avatar answered Dec 21 '22 16:12

zah