Javascript Articles

Page 515 of 534

MediaStream in HTML5

Daniol Thomas
Daniol Thomas
Updated on 28-Jan-2020 409 Views

The MediaStream represents synchronized streams of media. If there is no audio tracks, it returns an empty array and it will check video stream, if webcam connected, stream.getVideoTracks() returns an array of one MediaStreamTrack representing the stream from the webcam.function gotStream(stream) { window.AudioContext = window.AudioContext || window.webkitAudioContext; var audioContext = new AudioContext(); // Create an AudioNode from the stream var mediaStreamSource = audioContext.createMediaStreamSource(stream); // Connect it to destination to hear yourself // or any other node for processing! mediaStreamSource.connect(audioContext.destination); } navigator.getUserMedia({audio:true}, gotStream);

Read More

Stop Web Workers in HTML5

Nishtha Thakur
Nishtha Thakur
Updated on 28-Jan-2020 1K+ Views

Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions and allows long tasks to be executed without yielding to keep the page responsive.Web Workers don't stop by themselves but the page that started them can stop them by calling terminate() method.worker.terminate();A terminated Web Worker will no longer respond to messages or perform any additional computations. You cannot restart a worker; instead, you can create a new worker using the same URL.

Read More

Creating content with HTML5 Canvas much more complicated than authoring with Flash

Anvi Jain
Anvi Jain
Updated on 28-Jan-2020 178 Views

Flash provides amazing GUI and lots of visual features for animations. It allows the user build everything inside a particular platform without a full integration into the browser wrapped inside the browser with the main scopes that are multimedia and other kinds of animation.HTML5 element gives you an easy and powerful way to draw graphics using JavaScript. It can be used to draw graphs, make photo compositions or do simple (and not so simple) animations.Here is a simple element which has only two specific attributes width and height plus all the core HTML5 attributes like id, name, and ...

Read More

What is composition in HTML5 Canvas?

Arjun Thakur
Arjun Thakur
Updated on 28-Jan-2020 341 Views

HTML5 canvas provides compositing attribute globalCompositeOperation that affect all the drawing operations.ExampleWe can draw new shapes behind existing shapes and mask off certain areas, clear sections from the canvas using globalCompositeOperation attribute as shown below in the example.                    var compositeTypes = [             'source-over','source-in','source-out','source-atop',             'destination-over','destination-in','destination-out',             'destination-atop','lighter','darker','copy','xor'          ];          function drawShape(){             for (i=0;i

Read More

How to handle mousedown and mouseup with HTML5 Canvas

Daniol Thomas
Daniol Thomas
Updated on 27-Jan-2020 900 Views

To handle the mousedown and mouseup event with HTML5 Canvas,var mouseDown = false; // for mousedown canvas1.onmousedown = function(event){    dragOffset.x = event.x - mainLayer.trans.x;    dragOffset.y = event.y - mainLayer.trans.y;    mouseDown = true; } // for mouseup canvas1.onmouseup = function(event){    if(mouseDown) mouseClick(eevent    mouseDown = false; }

Read More

How to display HTML5 client-side validation error bubbles?

Arjun Thakur
Arjun Thakur
Updated on 27-Jan-2020 390 Views

To display HTML5 client-side validation error bubbles, use the required attribute.You do not need to have JavaScript for client side validations like empty text box would never be submitted because HTML5 introduced a new attribute called required which would be used as follows and would insist to have a value:                    Enter email :          Try to submit using Submit button                    

Read More

IE supports the HTML5 File API

Daniol Thomas
Daniol Thomas
Updated on 27-Jan-2020 187 Views

IE9 does not support File APIIF10 started supported File APIAn example of that would be drag and drop. Now HTML 5 came up with a Drag and Drop (DnD) API that brings native DnD support to the browser making it much easier to code up.                    #boxA, #boxB { float:left;padding:10px;margin:10px; -moz-user-select:none; }          #boxA { background-color: #6633FF; width:75px; height:75px; }          #boxB { background-color: #FF6699; width:150px; height:150px; }                      function dragStart(ev) {   ...

Read More

Make HTML5 Canvas fill the whole page

Chandu yadav
Chandu yadav
Updated on 27-Jan-2020 3K+ Views

To make canvas fill the whole page, you need to be 100% in width and height of the page.* {    margin: 0;    padding: 0; } body, html {    height:100%; } #canvas {    position:absolute;    height:100%; width:100%; }

Read More

Is there any way to embed a PDF file into an HTML5 page?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 27-Jan-2020 766 Views

To embed a PDF file in an HTML5 page, use the element.           HTML iframe Tag               HTML5 Tutorial          

Read More

What is the correct use of schema.org SiteNavigationElement in HTML?

Daniol Thomas
Daniol Thomas
Updated on 27-Jan-2020 841 Views

The schema.org SiteNavigationElement extends WebPageElement. It is used to mark-up links that would make amazing contextual links.                    Home page                              My demo page          

Read More
Showing 5141–5150 of 5,339 articles
« Prev 1 513 514 515 516 517 534 Next »
Advertisements