Closed Bug 773988 Opened 12 years ago Closed 11 years ago

Allow saving a snapshot from a media stream without a known filename

Categories

(Firefox :: Menus, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 28

People

(Reporter: jsmith, Assigned: florian)

References

Details

(Whiteboard: [getUserMedia], [blocking-gum-])

Attachments

(2 files)

Attached file Camera API Video Test
Steps:

1. Launch sample test case file attached in Nightly
2. Right click in the video tag
3. Select either save video as or save snapshot as

Expected:

Not entirely sure of the correct behavior here. Save snapshot as I'd expect to still be valid behavior here, as we should be able to capture a screenshot from a video deriving itself from getUserMedia. Save video as I'm not sure - if this intends to be supported, then the stream sent to the user needs to be able to be saved in file type for the output format of getUserMedia. If not, we'll have to explore other options.

Actual:

Nothing happens from an end-user perspective. An uncaught exception is seen in the error console:

Timestamp: 7/14/2012 12:18:07 PM
Error: uncaught exception: Load of [object MediaStream] from file:///C:/Users/jsmith/Documents/Camera%20API%20Video%20Test.html denied.
Repurpose bug - we need to disable functionality that will not work on a real-time video stream.
Summary: Using save video as or save snapshot as on a video using a stream from getUserMedia - nothing occurs, uncaught exception thrown → Options that are not appropriate for a real-time stream should be disabled for audio and video elements
Whiteboard: [getUserMedia], [blocking-gum+]
QA Contact: jsmith
Flags: in-qa-testsuite?
If we are going to disable the menu item we can simply check that with a Mochiteset. No need for a Mozmill test.

Also next time please add my name into the textbox so I get a in-qa-testsuite request in my inbox. Thanks.
Flags: in-qa-testsuite? → in-testsuite?
Whiteboard: [getUserMedia], [blocking-gum+] → [getUserMedia], [blocking-gum-]
Blocks: Talkilla
Component: WebRTC: Audio/Video → Video/Audio
Attached patch bug773988.patchSplinter Review
I tested this today. The "Save Video As…" and "Email Video…" items are disabled. The "Save Snapshot As…" item fails with a security error:
"Load of  from http://localhost:5000/chat.html denied."

I don't understand the purpose of this security check:
989     urlSecurityCheck(this.mediaURL,
990                      this._unremotePrincipal(this.browser.contentPrincipal),
991                      Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
at http://hg.mozilla.org/mozilla-central/annotate/770de5942471/browser/base/content/nsContextMenu.js#l989

this.mediaURL is an empty string here.
 
Just removing this check makes things work. Requesting review from dolske who thought this check may be needed in bug 681550 comment 5, hoping he remembers why :-).
Attachment #827411 - Flags: review?(dolske)
Comment on attachment 827411 [details] [diff] [review]
bug773988.patch

Review of attachment 827411 [details] [diff] [review]:
-----------------------------------------------------------------

I think I never actually looked into the aforementioned comment.

This seems fine. AIUI the security check is preventing untrusted content from linking/loading things it shouldn't be able to learn about. But we're only using the URL here as a hint for the filename, and content is out of the picture since this is chrome.
Attachment #827411 - Flags: review?(dolske) → review+
Summary: Options that are not appropriate for a real-time stream should be disabled for audio and video elements → Allow saving a snapshot from a media stream without a known filename
https://hg.mozilla.org/integration/fx-team/rev/fd5133a30882
Assignee: nobody → florian
Component: Video/Audio → Menus
Product: Core → Firefox
Blocks: 681550
https://hg.mozilla.org/mozilla-central/rev/fd5133a30882
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 28
Verified on x86_64 using latest nightly, found that "Save Video As" and "View Video" give error and "Save Snapshot As" is disabled. Not fixed.

Cannot attach the testfile, so, here is the dump of the html file:

<html>
	<head>
		<meta charset="utf-8">
		<title>Camera API - View User Stream Test Case</title>


		<style>
			.marker{border:5px solid red;}
		</style>

		<script src="http://code.jquery.com/jquery-latest.js"></script>
		<script type="text/javascript">
			
			function getUserStream() {
			
				if(navigator.mozGetUserMedia) {
					var video = document.getElementById('monitor');
				
					function gotStream(stream) {
						video.src = stream;
						video.play();
						video.onerror = function() {
							stream.stop();
						};
						stream.onended = noStream;
					}

					function noStream(err) {
						alert("Error occurred: " + err);
					}

					navigator.mozGetUserMedia({video: true}, gotStream, noStream);

				} else {

					alert("getUserMedia not supported");

				}
			
			}
			
			$(document).ready(function() {
				getUserStream();
			});
		</script>
	</head>
	<body>
		
		
		<video width="640" height="480" id="monitor" class = "marker"></video>
		
	</body>
</html>
Keywords: verifyme
QA Contact: jsmith
(In reply to ganesh_sahai1 from comment #10)
> Verified on x86_64 using latest nightly, found that "Save Video As" and
> "View Video" give error and "Save Snapshot As" is disabled. Not fixed.
> 
> Cannot attach the testfile, so, here is the dump of the html file:
> 
> <html>
> 	<head>
> 		<meta charset="utf-8">
> 		<title>Camera API - View User Stream Test Case</title>
> 
> 
> 		<style>
> 			.marker{border:5px solid red;}
> 		</style>
> 
> 		<script src="http://code.jquery.com/jquery-latest.js"></script>
> 		<script type="text/javascript">
> 			
> 			function getUserStream() {
> 			
> 				if(navigator.mozGetUserMedia) {
> 					var video = document.getElementById('monitor');
> 				
> 					function gotStream(stream) {
> 						video.src = stream;

This testcase is broken, replace this line with "video.mozSrcObject = stream;" and things work.
I am able to save screenshots using the demo from comment 10, on Windows 7x64, Ubuntu 13.04 x64 and Mac OS X 10.8.5 using latest Aurora 28.0a2.
Status: RESOLVED → VERIFIED
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: