How to manually verify fake video stream in chromedriver - selenium-chromedriver

What am I doing?
I am trying to send a media file to my automated browser tests in place of real webcam footage
Where did I try?
I found this nugget of information of someone using it and passed in the same options as he did https://github.com/webrtc/samples/issues/616 . So I've used the same options, different file formats (the y4m, mp4, mjpeg and other file formats), the path is an absolute file path on my mac.
What do I see?
When I navigate to sites like https://webcamtests.com/ to verify it, I see only my own camera showing my face. I notice the camera name starts out as videoinput#1 then switches to the name for my webcam.
What do I think is the problem?
I believe either the fake device isn't working, the virtual camera dies shortly after launch, or the file itself isn't be read.
What would I like help with exactly?
Has anyone here used the following chrome command line options?
--use-file-for-fake-video-capture=<filename>
--use-file-for-fake-audio-capture=<filename>
--use-fake-ui-for-media-stream
--use-fake-device-for-media-stream
I'm hoping to hear how folks used them and how they were able to manually verify they were working.

root issue found, I was using the wrong file formats.
use-file-for-fake-video-capture supports .mjpeg file format
use-file-for-fake-audio-capture supports .wav file format
also, audio files are busted on a mac https://bugs.chromium.org/p/chromedriver/issues/detail?id=3287

Related

How can i open h264 video files in virtualdub?

First the video files was mp4 then i converted them to avi files.
Now that they are avi files when i try to open a video file in virtualdub i'm getting this error:
Couldn't locat decompressor for format h264 (unknown) virtualdub requires video for windows vfw compaitable decompress ...etc
What i did so far ?
Install ffdshow in configuration i changed not to disable h264 and all others in decoder.
I installed divx
I have virtualdub 1.10.4
Now i'm using ffdshow 32bit i tried 64bit before
I have windows 8.1 pro 64bit
Tried almost or anything i found in google nothing worked so far.
I wanted to open the original mp4 video files in virtualdub but nothing worked so i converted it to avi but also not working.
What else can i do ?
Maybe there is another program like virtualdub that it will work ?
You need to install the h.264 VFW codec here: https://sourceforge.net/projects/x264vfw/
Just close VirtualDub beforehand, and pick the default options in the installer. Worked like a charm for me.
AFAIK the file being MP4 or AVI is unimportant, it's just a change of "container", ie. what's inside both files is a h.264 encoded video channel.
Caveat: as mentioned by Ivo Kostić in another answer, it doesn't work well with interlaced x264 (I have no experience with that, I just thought this important fact should also appear in the "top" answer).
I used the VirtualDub FFmpeg Input Driver Plugin, Direct sourcforge page
Download
Copy files to the plugins folders in the virtualdub directory
Restarted virtualdub
and no matter what you do currently x264vfw (either as standalone as mentioned by ghis, or via ffdshow's vfw config (decoder options)) doesn't work well with interlaced h264, it doubles the framerate and then it's not really usable esp. if you just wanna cut video in 'direct stream copy mode'.
a bug that probably won't be fixed.

Failed to Load Resource, Plugin Handled Load on iOS

Every time I try to view a video file on my server I get this error on iOS in Safari, Chrome.
I am using a blob server and then an Apache server so I am not sure what the problem is. However, when I only use Apache, I do get this error but then I have the video rendering too.
However when I render this using my server this is not working. Does anyone know why this is? The videos work fine on other devices and in browsers also works fine if accessed through Apache only.
The solution to this problem was just a work around. The reason being the that blob servers aren't streaming servers. iOS devices expect the videos to arrive in small chunks. So for instance a streaming server is able to do this. However, a blob server just hands the video as a blob which is not what the iOS device expects. Some browsers are smart enough to handle this but others not.
The way I solved this was to add the video files outside of the blob server in a folder within the project and then render this through the Apache server instead of serving it via the actual blob server we were using. I hope this helps.
I was also getting this error for some mp4 videos. Turns out it wasn't a server issue for me it was a video encoding issue.
Issue
A "moov atom" needs to be placed at the front of the video file. It serves as a table-of-contents for the video. That "moov atom" has to be read first for html streaming or it won't play on some devices.
The Fix
To fix, I used handbrake to transcode my video. Turn on 'web optimize' Also turning on zerolatency and 'fast decode' may help (found in the video tab).
We were getting a similar error here. I thought it may have been the streaming issue since our video was hosted in blob storage on Azure. After setting up a Media Service for streaming, the video still didn't work. It turns out, the cause of the bug for us was Safari using a Service Worker. Below is some further explanation of what we found:
Safari first sends a byte range request for a Video tag that expects a 206 response. However, if you use a Service worker, the response returns with a 200 and it appears Safari doesn't know how to handle this. Our solution was to exclude using a Service Worker for Safari.
We found this by using the network tab of the Safari debugger on a Macbook to troubleshoot the issue we were seeing on the iPad. Attached is a screenshot for comparison/reference. The left tab shows what the call should look like by default. The right tab shows what you would see if using a Service Worker.
Add the following line of code to your .htaccess (located in the root of your WordPress installation):
SetEnvIfNoCase Request_URI .(?:mp4)$ no-gzip dont-vary
The following screenshot is the new complete .htaccess
Reference: https://clickshepherd.com/blog/solved-elegant-themes-divi-and-cloudflare-mp4-media-error-formats-not-supported-or-sources-not-found/
In our case, we created a URL pattern for our blob assets and then set headers in that URL pattern definition page which sent back a mime type of 'video/mp4'. This should instruct the browser to treat the binary stream as chunked, which in turn meant we didn't need to download the whole thing before it started playing.
Google Cloud Platform Solution
This issue caused me a lot of headache, so I just wanted to add my specific solution here, if anyone else encounters this while deploying to Google Cloud Platform.
When trying to load MP4 videos in Safari, I was getting the same error:
"Failed to Load Resource, Plugin Handled Load"
Which was preventing the videos from playing.
Still, I wanted to try to keep everything inside Google Cloud, so I created a Storage Bucket for the site, and added the videos there.
Of course, trying to retrieve the videos from the storage URL from the main site resulted in a CORS error.
Fortunately, you can configure CORS pretty easily on storage buckets:
Configuring cross-origin resource sharing (CORS)
Once that configuration was deployed, I was able to retrieve and load the videos on the site in Safari without the "plugin handled load" error.
I saw the error "Failed to Load Resource" and though that this is reason, why my videos are not playing.
Turned out, my videos were missing the hvc1 tag. And when I added it - they're playing fine.
In my case issue was with H256 HEVC videos, but in your case some other encoding / tagging issues can be the reason.
In my case, issue was fixed with ffmpeg:
ffmpeg -i input.mp4 -tag:v hvc1 -acodec copy -c:v copy -movflags faststart out.mp4

How to open html link to local file in its default program, NOT browser?

Basically, I'm creating a webpage filled with images of movie posters that link to video files, as a means of making a more visually-appealing form of my local video library.
I'm using
<a href="C:\blah\movie.mkv"><img src="poster.jpg">
It works exactly how I want, HOWEVER, it opens the file in the browser rather than opening it in its default program, as I would like. I would like each link to open the file in the program titled "VLC Media Player", as specified in Windows for each of their filetypes.
Let me know how I can do this (in the simplest form--I'm not too smart :P)
Thanks!
If you are creating web pages on your local system for you own use then you may want to consider looking in to a WAMP server setup. This uses php and should allow you to call VLC using the exec command. Would take some learning however.
There is very little you can do to control how a client will handle a resource.
You can use the Content-Disposition HTTP response header to state that the resource is an attachment (and thus recommend that it be downloaded instead of opened).
Content-Disposition: attachment;filename="movie.mkv"
You can't, however, stop browser native support or a plug-in from handling something instead of having it open in a separate application (let alone cause it to be opened in a specific application).
If the browser is configured to open video files internally, then nothing the author of a website can do will make it switch to using a application instead.

Where does PERSISTENT file system storage store with chrome?

When doing webkitRequestFileSystem in window.PERSISTENT option in Google Chrome, where on my filesystem do files get written? I'd like to drop files there and have Chrome interact with them while I'm building and debugging this app.
For me, at least on Mac OSX, they're stored under /Users/USERNAME/Library/Application Support/Google/Chrome/Default/File System for me. If you're using profiles, there will be profile directories instead of Default. However, each origin's saved files/folders are obfuscated under directories that won't be easy for you to interact with.
For debugging the Filesystem API, you have a few options:
Use this extension to view/remove files.
See the tips here: http://updates.html5rocks.com/2011/08/Debugging-the-Filesystem-API
That includes viewing stored files very easily using the filesystem: URLs.
Drop the Filesystem Playground demo (http://html5-demos.appspot.com/static/filesystem/filer.js/demos/index.html) into your origin. You can use that to view/rename/delete files/folders easily.
Chrome DevTools now has support for the Filesystem API for viewing the files stored under an origin. To use that, you will need to enable the Developer Tools experiments in about:flags, restart, hit the gear in the devtools (lower right corner), and enable the 'FileSystem inspection' under the experimental tab.
Just for completeness: on linux it goes into ~/.config/google-chrome/Default/File\ System/
On Windows XP, it is here: c:\Documents and Settings\USERNAME\Local Settings\Application Data\Google\Chrome\User Data\Default\File System\.
On Windows 7, the location is C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data\Default\File System.
It's not very useful to browse it because file and dir names are obfuscated (but content in files is unchanged).
As ebidel wrote the best way is using browser of filesystem: urls that incorporated into Chrome. It's excellent! You can get the url using fs.root.toURL() where fs is a FileSystem object that you get, for example, from window.webkitRequestFileSystem().
Seems like the filesystem storage is encoded to prevent exactly what was trying to do. I ended up writing a very simple file manager available here. Start up any web server (I like mongoose for its 0 setup) and go to the /filemanager.html route
I saved a file called log.txt on MAC
It ended up at
~/Library/Application\Support/Google/Chrome/Default/Storage/ext/panbljeniblfmcakpphmjmmnpcaibipi/def/File\ System/iso/p/00/
with file name 00000 and no ext
If you are using MAC OX, and you have more than one profile on your chrome, or you cannot find default in the path, replace default with profile. But depending on number of profiles you have, it could be profile 1, profile 2, etc

Offline web app for distribution in pendrives (Windows only)?

We are trying to distribute a basic HTML file with some links to a PDF document in a USB drive for advertising purposes. The idea is that an autorun opens up this HTML in the default browser. However, this might not be a good idea since it would look very amateur-ish and we will have to rely on the default browser's technology (which unfortunately has a good chance on being IE6/7!)
We've explored a few alternatives, but we can't find one that really fits what we are trying to achieve:
Mozilla Prism
Altough it seems like it's designed with offline web apps in mind, the executable creates files in the user's AppData directory and it's hard to configure the default paths. Also, Firefox doesn't have a default PDF viewer, so we will have to depend on the user's default PDF viewer (which might be Adobe Reader)
Mozilla Chromeless
Since Prism is inactive, the idea is still developing with Chromeless, which allows the developer to create the browser interface with basic HTML/JS/CSS. The main issue here is that somehow the build isn't loading HTML, all that's showing is a gray iframe. I'm not sure if it's just me, because there's nothing on the issues page.
Portable App
We could throw in the portable version of Firefox or Chrome and customize the XUL for Firefox or open Chrome in app mode.
Firefox's advantage is that it kind of supports relative paths (resource://), but it doesn't have a built-in PDF viewer. Chrome has a very good and lightweight PDF viewer and the built-in app mode is a very useful feature for us, but I can't find how to open a local path without the usual absolute path (file:///C:/) since we don't know what's the drive's letter.
Has anyone figure out how to handle this kind of issues? Thanks.
This has been asked three years ago, but it's unanswered, listed high in Google, and I stumbled over the exact same problem and can imagine that many others that seek to ship portable web apps that can be run locally and with a minimum of dependencies will encounter this issue, too.
The solution I am now going with is the node-webkit.
You can treat it like a portable version of chrome, however it excepts a relative path to your app's entry point, is about 40 MB smaller, and much more customizable than the --app mode of chrome (which isn't customizable at all if I remember correctly).
Github & Download:
https://github.com/rogerwang/node-webkit#downloads
An extensive guide:
http://thejackalofjavascript.com/getting-started-with-node-webkit-apps/
My usage suggestion for Windows:
First create an app package as explained in the guide linked above
For the node-wekit to load with your app, you need to start it like this:
nw.exe app.package
Where nw.exe is in the root of the zipped folder you downloaded and app.package is a zip file (can have any name) that contains your app data and package.json.
To do this silently, you can use a BAT file containing the (amended) call above and a VBS file containing something like this:
CreateObject("Wscript.Shell").Run "cmd /c launchNW.bat", 0, true
launchNW.bat being the name of your BAT file. Now run the VBS file; a window containing your web app should pop up without the command window appearing with it.
Finish reading the linked guide to learn more about customization options to do things like hiding the browser UI etc.