Lakshmi Srinivas has Published 315 Articles

Play video on canvas and preserve the last frame/image on HTML5 Canvas

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 29-Jan-2020 06:38:07

203 Views

You can try to run the following code to play and preserve the video’s last frame:var c = $('canvas')[0]; var context = canvas.getContext('2d'); c.width = 640; c.height = 480; $("#, myPlayer").on('play', function (e) {    var $this = this;    (function loop() {       if (!$this.paused ... Read More

How to make iOS UIWebView display a mobile website correctly?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 29-Jan-2020 06:28:55

72 Views

To display the mobile website correctly, try the following fix:mywebview.scalesPageToFit = YES; mywebview.contentMode = UIViewContentModeScaleAspectFit;You can also set the following:NSString *js = [NSString stringWithFormat:@"document.body.style.zoom = 0.8;"]; [webView stringByEvaluatingJavaScriptFromString:js];

How do I programmatically create a DragEvent for Angular app and HTML?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 29-Jan-2020 06:26:48

127 Views

To create a DragEvent, use the protractor API. The official documentation states:The browser.get method loads a page. Protractor expects Angular to be present on a page, so it will throw an error if the page it is attempting to load does not contain the Angular library. (If you need to interact ... Read More

Programmatically fire HTML5 dragstart after mousemove

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 29-Jan-2020 06:25:28

125 Views

To fire dragstart after mousemove, try the following:If you are firing dragstart event, then implement the rest of the process flow as well:To solve the problem, create the user experience as follows: You need to instruct the user to click on the respective area for enabling drag When a user clicks on ... Read More

What MySQL returns when we remove all the columns from a table by using ALTER TABLE command with DROP keyword?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 29-Jan-2020 05:37:18

95 Views

Eventually, we cannot remove all the columns from a table by using ALTER TABLE command with DROP keyword. In this case, MySQL will return an error message. It is demonstrated with the help of the following exampleSuppose in table ‘Employee’ we have two columns ‘name’ and ‘id’, now if we ... Read More

Do we have any other statement in MySQL instead of SHOW COLUMNS to get the list of columns in an existing table?

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 29-Jan-2020 05:12:52

67 Views

Yes, we can use DESCRIBE or EXPLAIN statements instead of SHOW COLUMNS statement to get the list of the columns in an existing table. In the example below we have applied DESCRIBE and EXPLAIN statement on ‘Employee’ table and got the same result set as got after SHOW COLUMNS statement ... Read More

Unable to take a photo from webcam using HTML5 and on the first page load

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 28-Jan-2020 10:32:55

202 Views

You need to try the following to take photo from webcam using HTML5:Declare variablesvar streaming = false,    video = document.querySelector('#video'), canvas = document.querySelector('#canvas'),    photo = document.querySelector('#photo'),    startbutton = document.querySelector('#startbutton'),    width = 320,    height = 0;Using getUserMedianavigator.getMedia = ( navigator.getUserMedia ||           ... Read More

HTML5 audio control stop button

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 28-Jan-2020 10:20:06

928 Views

Try the following code to add a stop button to your audio in HTML5:function displayStopBtn() {    var myPlayer = document.getElementsByTagName('audio')[0];    myPlayer.pause();    myPlayer.currentTime = 0; }You can also include jQuery:$("#stopButton").click(function () {    audio.pause();    audio.currentTime = 0; });

Full page drag and drop files website with HTML

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 28-Jan-2020 10:18:14

294 Views

For full page drag and drop files, try the following code:var myDrop = document.getElementById('dropZone'); function displayDropZone() {    myDrop.style.visibility = "visible"; } function hideDropZone() {    myDrop.style.visibility = "hidden"; } function allowDrag(ev) {    if (true) {       ev.dataTransfer.dropEffect = 'copy';       ev.preventDefault();    } } ... Read More

Move an HTML div in a curved path

Lakshmi Srinivas

Lakshmi Srinivas

Updated on 28-Jan-2020 10:03:41

250 Views

To move an HTML div in a curved path, use any of the following: CSS Transitions JavaScript (jQuery) HTML5 CanvasTry JavaScript to make it work in every browser.Use the animate() method. The animate() method performs a custom animation of a set of CSS properties.The following is the syntax:selector.animate( params, [duration, easing, callback] );Here ... Read More

Advertisements