new NetworkService - allow custom schema load local resource

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

new NetworkService - allow custom schema load local resource

Postby ebahar » Tue Nov 05, 2019 2:54 pm

Hi,
I'm upgrading to CEF 78 (branch 3904) and i'm having some issue when i try to load
local file (e.g "file://%PATH%.webm") in my custom page.
1. i create custom scheme using
registrar->AddCustomScheme(
"client", CEF_SCHEME_OPTION_STANDARD | CEF_SCHEME_OPTION_CORS_ENABLED | CEF_SCHEME_OPTION_SECURE | CEF_SCHEME_OPTION_CSP_BYPASSING);


2. loading my page client://test.html
the test.html contains video element to src = local file (e.g "file://%PATH%.webm")

when i load it,
in the network tab i'm getting "err_unknown_url_scheme" for "file://%PATH%.webm" ..

is there a way to fix it without adding |CEF_SCHEME_OPTION_LOCAL| flag?

thanks,
ebahar
Techie
 
Posts: 46
Joined: Tue Nov 22, 2016 3:52 am

Re: new NetworkService - allow custom schema load local reso

Postby magreenblatt » Tue Nov 05, 2019 3:36 pm

The file:// scheme is intentionally isolated from other schemes. Serve your video via a handler instead.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: new NetworkService - allow custom schema load local reso

Postby ebahar » Wed Nov 06, 2019 11:53 am

not working either via handler, (works fine on cef 71)
ebahar
Techie
 
Posts: 46
Joined: Tue Nov 22, 2016 3:52 am

Re: new NetworkService - allow custom schema load local reso

Postby ebahar » Thu Nov 07, 2019 8:16 am

Hi @magreenblatt

So I'm pretty lost here...
i have code that works for several years which my application is serving
via custom CEF resource handler a local video\audio files.
(for all other resources it is still working just fine e.g images, icons and local js\html files)

1. i have a custom Scheme "client-resource"
2. implement a resource handler which adds the needed responses headers:
a. setting "Access-Control-Allow-Origin", "Content-Type", "Content-Length",
and for video i also set the "Range" needed repose values.
b. setting the Status code to 200 (or 206 when needed)

3. the read function callback is reached several times and i fill the output buffer from my local stream.

but the video is not rendering, and the log file show this error:
[1107/145416.091:ERROR:batching_media_log.cc(26)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"FFmpegDemuxer: open context failed"}
[1107/145416.092:ERROR:batching_media_log.cc(26)] MediaEvent: PIPELINE_ERROR DEMUXER_ERROR_COULD_NOT_OPEN


this is my test html file:
Code: Select all
<!DOCTYPE html>
<html>
<!-- <body style="background-color: red;"> -->
<body>

 <video width="600px" id="myvideo" controls>
  <source src="client-resource://test-video.mp4"  type="video/mp4"> 
 </video>
 
</body>
</html>



any help will be much appreciated,

thanks,
ebahar
Techie
 
Posts: 46
Joined: Tue Nov 22, 2016 3:52 am

Re: new NetworkService - allow custom schema load local reso

Postby Czarek » Thu Nov 07, 2019 8:33 am

How are you loading test.html?
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: new NetworkService - allow custom schema load local reso

Postby ebahar » Thu Nov 07, 2019 8:53 am

basically my app has other custom scheme and i load the with
client://test.html, but for testing i just navigate the browser view directly to
"client-resource://test-video.mp4" which load chromium media player and the video should start playing
ebahar
Techie
 
Posts: 46
Joined: Tue Nov 22, 2016 3:52 am

Re: new NetworkService - allow custom schema load local reso

Postby Czarek » Thu Nov 07, 2019 9:54 am

Try using the same scheme for both urls.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: new NetworkService - allow custom schema load local reso

Postby ebahar » Thu Nov 07, 2019 10:06 am

i did,
not working also..
ebahar
Techie
 
Posts: 46
Joined: Tue Nov 22, 2016 3:52 am

Re: new NetworkService - allow custom schema load local reso

Postby gagere » Wed Dec 04, 2019 4:19 pm

We are also seeing this now that we are upgrading from CEF 3683/73 to CEF 3094/78.

The webm videos load and play fine in the sample cefclient and also when we host them in a local node webserver.

However when we use our custom scheme handler (http scheme, but custom domain) to load the file from the file system it seems like it fails to detect the WEBM and decides it needs the proprietary codecs in ffmpeg which don't exist in the pre-built binaries that we've been using.

We've basically followed the example from https://bitbucket.org/chromiumembedded/ ... me-handler creating a CefStreamResourceHandler with a CefStreamReader and setting the mime type to video/webm.

This used to work. Any ideas on what might have changed to break this?
gagere
Newbie
 
Posts: 6
Joined: Tue Oct 08, 2013 8:30 pm

Re: new NetworkService - allow custom schema load local reso

Postby ebahar » Sun Dec 08, 2019 2:59 am

it's something to do with the new Network service out of process.

in order to overcome this issue i had to do the following hack:
1. when loading custom scheme witch is a video\audio file,
i redirect the url to "file://..."
2. in order the page loading "file://" scheme i had to change the chromium code to create
UrlFileFacroty for every navigation (and handle blocking "file:///" in my costume handlers)
ebahar
Techie
 
Posts: 46
Joined: Tue Nov 22, 2016 3:52 am

Next

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 74 guests