Comments on: Your Questions #13 https://stevefaulkner.github.io/html5doctored/your-questions-13/ helping you implement HTML5 today Thu, 23 Jun 2016 13:06:36 +0000 hourly 1 By: Brad https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-14177 Thu, 10 Feb 2011 08:25:47 +0000 http://html5doctor.com/?p=2382#comment-14177 Hi,
Great stuff on this site with regards to HTML5 :)

The problem I am having is the following:
I use a video and a canvas tag and capture a frame from the video tag and place it into the canvas tag, but when I create a reference of the canvas in javascript so that I may return the dataURL it bombs out.
Here is the code I use to place the frame from the video:
_________________________________________________________________
var video = document.getElementById(“video”);

var canvasDraw = document.getElementById(‘imageView’);
var w = canvasDraw.width;
var h = canvasDraw.height;
var ctxDraw = canvasDraw.getContext(’2d’);

ctxDraw.clearRect(0, 0, w, h);
ctxDraw.clearRect(0, 0, w, h);
ctxDraw.drawImage(video, 0, 0, w, h);
_________________________________________________________________
The above works perfectly.
Below is the code to get the dataURL:
_________________________________________________________________
function getURIformcanvas() {
var ImageURItoShow = “”;
var canvasFromVideo = document.getElementById(“imageView”);
if (canvasFromVideo.getContext) {
var ctx = canvasFromVideo.getContext(“2d”); // Get the context for the canvas.

var ImageURItoShow = canvasFromVideo.toDataURL(“image/png”); //<– It fails on this line.
}
var doc = document.getElementById("txtUriShow");
doc.value = ImageURItoShow;

}
_______________________________________________________________
It always fails on the line:
var ImageURItoShow = canvasFromVideo.toDataURL("image/png");

Any thought on what might be the problem. If I load a normal image into the canvas it works fine, but as soon as I load the image from video into the canvas that line fails.

Any ideas?

]]>
By: Brad https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-14176 Thu, 10 Feb 2011 08:23:48 +0000 http://html5doctor.com/?p=2382#comment-14176 Hi,
The problem I am having is the following:
I use a video and a canvas tag and capture a frame from the video tag and place it into the canvas tag, but when I create a reference of the canvas in javascript so that I may return the dataURL it bombs out.
Here is the code I use to place the frame from the video:
_________________________________________________________________
var video = document.getElementById(“video”);

var canvasDraw = document.getElementById(‘imageView’);
var w = canvasDraw.width;
var h = canvasDraw.height;
var ctxDraw = canvasDraw.getContext(’2d’);

ctxDraw.clearRect(0, 0, w, h);
ctxDraw.clearRect(0, 0, w, h);
ctxDraw.drawImage(video, 0, 0, w, h);
_________________________________________________________________
The above works perfectly.
Below is the code to get the dataURL:
_________________________________________________________________
function getURIformcanvas() {
var ImageURItoShow = “”;
var canvasFromVideo = document.getElementById(“imageView”);
if (canvasFromVideo.getContext) {
var ctx = canvasFromVideo.getContext(“2d”); // Get the context for the canvas.

var ImageURItoShow = canvasFromVideo.toDataURL(“image/png”); //<– It fails on this line.
}
var doc = document.getElementById("txtUriShow");
doc.value = ImageURItoShow;

}
_______________________________________________________________
It always fails on the line:
var ImageURItoShow = canvasFromVideo.toDataURL("image/png");

Any thought on what might be the problem. If I load a normal image into the canvas it works fine, but as soon as I load the image from video into the canvas that line fails.

Any ideas?

]]>
By: Michael J. Ryan https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-12105 Wed, 24 Nov 2010 21:32:28 +0000 http://html5doctor.com/?p=2382#comment-12105 Regarding H1-H6, my rule of thumb is only one h1 on a page… usually the same with H2 if there’s a sub-header… ex: h1 = page title, h2 = site title… then h3 for section headings, and h4-h6 for subsection headings. It’s just cleaner imho. Though I’ve also been limiting my use to [article] [hgroup] [h3] section [/h3] [/hgroup] [details] … [/details] [/article] as a general pattern… Not a rule perse but a reasonable organizational pattern for content.

]]>
By: Richard Clark https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-11155 Wed, 29 Sep 2010 11:15:26 +0000 http://html5doctor.com/?p=2382#comment-11155 @Shelley, good point on custom elements.

@Felix thanks for that.

@Brian, as you can imagine we’ve got quite a backlog! Thanks for the update.

]]>
By: Brian LePore https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-11143 Tue, 28 Sep 2010 22:11:54 +0000 http://html5doctor.com/?p=2382#comment-11143 Wow, I asked that a while ago …

I just wanted to follow this up by bringing up that you can add HTML5 elements to Tidy using the new-blocklevel-tags and new-empty-tags configuration settings. They do not enforce things like the source element only appearing inside of video and audio tags, but if your output is already valid it will keep them from being stripped and keep the markup as-is.

]]>
By: Felix https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-11141 Tue, 28 Sep 2010 18:49:15 +0000 http://html5doctor.com/?p=2382#comment-11141 I think the problem with the “Immutable image” is because Mike wants to erase a part of the canvas, but instead he just draws with white color. White!=transparent! You maybe want something like clearRect()

]]>
By: Shelley https://stevefaulkner.github.io/html5doctored/your-questions-13/#comment-11134 Tue, 28 Sep 2010 14:29:23 +0000 http://html5doctor.com/?p=2382#comment-11134 One of the real problems with using “custom” HTML elements, without the use of namespaces, is that there could be name collision at some point in time. If a person uses a reasonable element name such as “content” today, and “content” is added in HTML6, then their use of content could conflict with the new standard use of the element “content”.

]]>