how to enable audio/sound of web media in cefsharp offscreen(c#)?












0















How do I enable audio/sound of web media in cefsharp offscreen?
When using cefsharp winform, it works fine. audis is running.



However, I must use it offscreen, so I have changed from winform to offscreen.
Thereafter, a failure audio running. Media audio is played using webRTC.



This is the CefSettings c# code.



CefSettings settings = new CefSettings();
CefSharpSettings.LegacyJavascriptBindingEnabled = true; // Enable Register JS Object, -- RegisterAsyncJsObject, RegisterJsObject allow

settings.CachePath = "cache";
settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC

//NOTE: The following function will set all three params
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");

//NOTE: The Custom Scheme set up to embedded resources
settings.RegisterScheme(new CefCustomScheme()
{
SchemeName = ResourceSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new ResourceSchemeHandlerFactory()
});

Cef.Initialize(settings);


This is browserSettings code.



BrowserSettings browserSettings = new BrowserSettings();
browserSettings.FileAccessFromFileUrls = CefState.Enabled;
browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
browserSettings.WebSecurity = CefState.Disabled;

nxBrowser = new ChromiumWebBrowser("resource://web/nxwebRTCAPI.html", browserSettings);
nxBrowser.RegisterJsObject("callBackObj", this);


and this is the html source.



<body>
<script src="js/nxWebApi.js"></script>
<script src="js/nxCallBack.js"></script>

<audio id="audio_remote" autoplay="autoplay"> </audio>
</body>
</html>


Please check my problems in the code.










share|improve this question

























  • audio is muted by default in 69.0.0, see github.com/cefsharp/CefSharp/commit/… you just need to remove the entry from CefCommandLineArgs.

    – amaitland
    Nov 22 '18 at 1:01











  • @amaitland thanks to you, I solved it. but i using cefsharp.offscreen version is 67.0.0. in the 67.0.0 seems to have a audio is muted by default. I modified the CefSettings code and solved it. This is the code. settings.CefCommandLineArgs.Remove("mute-audio");

    – JinoKiM
    Nov 22 '18 at 1:53













  • You are correct, it should have been 67.0.0. Remember it's open source, so rather than guessing you can just look at the code, see github.com/cefsharp/CefSharp/blob/cefsharp/67/…

    – amaitland
    Nov 22 '18 at 2:43
















0















How do I enable audio/sound of web media in cefsharp offscreen?
When using cefsharp winform, it works fine. audis is running.



However, I must use it offscreen, so I have changed from winform to offscreen.
Thereafter, a failure audio running. Media audio is played using webRTC.



This is the CefSettings c# code.



CefSettings settings = new CefSettings();
CefSharpSettings.LegacyJavascriptBindingEnabled = true; // Enable Register JS Object, -- RegisterAsyncJsObject, RegisterJsObject allow

settings.CachePath = "cache";
settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC

//NOTE: The following function will set all three params
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");

//NOTE: The Custom Scheme set up to embedded resources
settings.RegisterScheme(new CefCustomScheme()
{
SchemeName = ResourceSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new ResourceSchemeHandlerFactory()
});

Cef.Initialize(settings);


This is browserSettings code.



BrowserSettings browserSettings = new BrowserSettings();
browserSettings.FileAccessFromFileUrls = CefState.Enabled;
browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
browserSettings.WebSecurity = CefState.Disabled;

nxBrowser = new ChromiumWebBrowser("resource://web/nxwebRTCAPI.html", browserSettings);
nxBrowser.RegisterJsObject("callBackObj", this);


and this is the html source.



<body>
<script src="js/nxWebApi.js"></script>
<script src="js/nxCallBack.js"></script>

<audio id="audio_remote" autoplay="autoplay"> </audio>
</body>
</html>


Please check my problems in the code.










share|improve this question

























  • audio is muted by default in 69.0.0, see github.com/cefsharp/CefSharp/commit/… you just need to remove the entry from CefCommandLineArgs.

    – amaitland
    Nov 22 '18 at 1:01











  • @amaitland thanks to you, I solved it. but i using cefsharp.offscreen version is 67.0.0. in the 67.0.0 seems to have a audio is muted by default. I modified the CefSettings code and solved it. This is the code. settings.CefCommandLineArgs.Remove("mute-audio");

    – JinoKiM
    Nov 22 '18 at 1:53













  • You are correct, it should have been 67.0.0. Remember it's open source, so rather than guessing you can just look at the code, see github.com/cefsharp/CefSharp/blob/cefsharp/67/…

    – amaitland
    Nov 22 '18 at 2:43














0












0








0








How do I enable audio/sound of web media in cefsharp offscreen?
When using cefsharp winform, it works fine. audis is running.



However, I must use it offscreen, so I have changed from winform to offscreen.
Thereafter, a failure audio running. Media audio is played using webRTC.



This is the CefSettings c# code.



CefSettings settings = new CefSettings();
CefSharpSettings.LegacyJavascriptBindingEnabled = true; // Enable Register JS Object, -- RegisterAsyncJsObject, RegisterJsObject allow

settings.CachePath = "cache";
settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC

//NOTE: The following function will set all three params
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");

//NOTE: The Custom Scheme set up to embedded resources
settings.RegisterScheme(new CefCustomScheme()
{
SchemeName = ResourceSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new ResourceSchemeHandlerFactory()
});

Cef.Initialize(settings);


This is browserSettings code.



BrowserSettings browserSettings = new BrowserSettings();
browserSettings.FileAccessFromFileUrls = CefState.Enabled;
browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
browserSettings.WebSecurity = CefState.Disabled;

nxBrowser = new ChromiumWebBrowser("resource://web/nxwebRTCAPI.html", browserSettings);
nxBrowser.RegisterJsObject("callBackObj", this);


and this is the html source.



<body>
<script src="js/nxWebApi.js"></script>
<script src="js/nxCallBack.js"></script>

<audio id="audio_remote" autoplay="autoplay"> </audio>
</body>
</html>


Please check my problems in the code.










share|improve this question
















How do I enable audio/sound of web media in cefsharp offscreen?
When using cefsharp winform, it works fine. audis is running.



However, I must use it offscreen, so I have changed from winform to offscreen.
Thereafter, a failure audio running. Media audio is played using webRTC.



This is the CefSettings c# code.



CefSettings settings = new CefSettings();
CefSharpSettings.LegacyJavascriptBindingEnabled = true; // Enable Register JS Object, -- RegisterAsyncJsObject, RegisterJsObject allow

settings.CachePath = "cache";
settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //Enable WebRTC

//NOTE: The following function will set all three params
settings.CefCommandLineArgs.Add("disable-gpu", "1");
settings.CefCommandLineArgs.Add("disable-gpu-compositing", "1");

//NOTE: The Custom Scheme set up to embedded resources
settings.RegisterScheme(new CefCustomScheme()
{
SchemeName = ResourceSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new ResourceSchemeHandlerFactory()
});

Cef.Initialize(settings);


This is browserSettings code.



BrowserSettings browserSettings = new BrowserSettings();
browserSettings.FileAccessFromFileUrls = CefState.Enabled;
browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
browserSettings.WebSecurity = CefState.Disabled;

nxBrowser = new ChromiumWebBrowser("resource://web/nxwebRTCAPI.html", browserSettings);
nxBrowser.RegisterJsObject("callBackObj", this);


and this is the html source.



<body>
<script src="js/nxWebApi.js"></script>
<script src="js/nxCallBack.js"></script>

<audio id="audio_remote" autoplay="autoplay"> </audio>
</body>
</html>


Please check my problems in the code.







c# cefsharp cefsharp.offscreen






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 1:03









Marcus Campbell

2,03921127




2,03921127










asked Nov 22 '18 at 0:52









JinoKiMJinoKiM

11




11













  • audio is muted by default in 69.0.0, see github.com/cefsharp/CefSharp/commit/… you just need to remove the entry from CefCommandLineArgs.

    – amaitland
    Nov 22 '18 at 1:01











  • @amaitland thanks to you, I solved it. but i using cefsharp.offscreen version is 67.0.0. in the 67.0.0 seems to have a audio is muted by default. I modified the CefSettings code and solved it. This is the code. settings.CefCommandLineArgs.Remove("mute-audio");

    – JinoKiM
    Nov 22 '18 at 1:53













  • You are correct, it should have been 67.0.0. Remember it's open source, so rather than guessing you can just look at the code, see github.com/cefsharp/CefSharp/blob/cefsharp/67/…

    – amaitland
    Nov 22 '18 at 2:43



















  • audio is muted by default in 69.0.0, see github.com/cefsharp/CefSharp/commit/… you just need to remove the entry from CefCommandLineArgs.

    – amaitland
    Nov 22 '18 at 1:01











  • @amaitland thanks to you, I solved it. but i using cefsharp.offscreen version is 67.0.0. in the 67.0.0 seems to have a audio is muted by default. I modified the CefSettings code and solved it. This is the code. settings.CefCommandLineArgs.Remove("mute-audio");

    – JinoKiM
    Nov 22 '18 at 1:53













  • You are correct, it should have been 67.0.0. Remember it's open source, so rather than guessing you can just look at the code, see github.com/cefsharp/CefSharp/blob/cefsharp/67/…

    – amaitland
    Nov 22 '18 at 2:43

















audio is muted by default in 69.0.0, see github.com/cefsharp/CefSharp/commit/… you just need to remove the entry from CefCommandLineArgs.

– amaitland
Nov 22 '18 at 1:01





audio is muted by default in 69.0.0, see github.com/cefsharp/CefSharp/commit/… you just need to remove the entry from CefCommandLineArgs.

– amaitland
Nov 22 '18 at 1:01













@amaitland thanks to you, I solved it. but i using cefsharp.offscreen version is 67.0.0. in the 67.0.0 seems to have a audio is muted by default. I modified the CefSettings code and solved it. This is the code. settings.CefCommandLineArgs.Remove("mute-audio");

– JinoKiM
Nov 22 '18 at 1:53







@amaitland thanks to you, I solved it. but i using cefsharp.offscreen version is 67.0.0. in the 67.0.0 seems to have a audio is muted by default. I modified the CefSettings code and solved it. This is the code. settings.CefCommandLineArgs.Remove("mute-audio");

– JinoKiM
Nov 22 '18 at 1:53















You are correct, it should have been 67.0.0. Remember it's open source, so rather than guessing you can just look at the code, see github.com/cefsharp/CefSharp/blob/cefsharp/67/…

– amaitland
Nov 22 '18 at 2:43





You are correct, it should have been 67.0.0. Remember it's open source, so rather than guessing you can just look at the code, see github.com/cefsharp/CefSharp/blob/cefsharp/67/…

– amaitland
Nov 22 '18 at 2:43












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422470%2fhow-to-enable-audio-sound-of-web-media-in-cefsharp-offscreenc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422470%2fhow-to-enable-audio-sound-of-web-media-in-cefsharp-offscreenc%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy