Creating User Interfaces HTML5 video & audio. Role of video and audio. Homework: Complete your own [small/simple] HTML5 video and audio projects.

Slides:



Advertisements
Similar presentations
1 HTML5 Audio and Video Credits: Dr. Jay Urbain
Advertisements

SHAREPOINT PAKISTAN USER GROUP #1 SHAREPOINT COMMUNITY IN PAKISTAN AND ASIA HTML5 and SharePoint 2013.
Robotics Coordinates, position, orientation kinematics. HTML5 reading file. Homework: Prepare for lab. Postings.
HTML 5 and CSS 3, Illustrated Complete Unit K: Incorporating Video and Audio.
Chapter 6 Photoshop and ImageReady: Part II The Web Warrior Guide to Web Design Technologies.
HTML 5. What is HTML5? HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. The previous version of HTML came in The web has changed.
HTML5 Examples drawing on canvas (paths, text, video), mouse events, timed events, objects, semantic elements, etc. Jeanine Meyer Purchase College/SUNY.
HTML 5 Previous version: HTML4.01, 1999 Still work in progress, most browsers support some of it.
Video, audio, embed, iframe, HTML Form
Programming games More drawing. Text. Radian measure. Faces. Homework: Do your own drawings. Create index.html file. Upload work.
INF Web Design Using Multimedia on the Web Video - Part 1.
Computer Science 103 Chapter 4 Advanced JavaScript.
Chapter 15 HTML 5 Video and Audio Intro to HTML5 1.
Audio and Video on the Web Sec 5-12 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Introduction to HTML5 Jeanine Meyer Purchase College/SUNY.
Session: 11. © Aptech Ltd. 2HTML5 Audio and Video / Session 11  Describe the need for multimedia in HTML5  List the supported media types in HTML5 
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Video on the Web. The Evolution of web video formats… WebM (Supported by Google) Ogg (Supported by Theora) Mp4 (h264 video encoding) WebM (Supported by.
CHAPTER 18 INTEGRATING AUDIO AND VIDEO. LEARNING OBJECTIVES How the HTML 5 and tag pair can be used to include a video file within a webpage How video.
HTML5. What is HTML5? HTML5 will be the new standard for HTML. HTML5 is the next generation of HTML. HTML5 is still a work in progress. However, the major.
1 Introduction to HTML5. 2 Introductions –Lecture is based on the book: –The Essential Guide to HTML5: Using Games to learn HTML5 & JavaScript.
IT Engineering I Instructor: Rezvan Shiravi
Create Interfaces College exercise. Continue HTML5: HTML5 logo, drawing images. Coin toss. Homework: acquire video & audio.
Programming games Examples: Audio example. Google Maps api. Classwork: show more complex video. Classwork/Homework: Find place (lat and long) for basic.
Programming games Recap. Upload work (Filezilla, index.html). Drawing lines. Drawing stars. Homework: Drawing exercises.
Programming Games Basic HTML5 audio example. Catch-up. Work on basic video. Homework: Complete basic video.
Programming Games Show your cannonball. HTML5 video. Miro. Classwork/Homework: Acquire video, convert to multiple formats, and produce simple (just html)
Locally Edited Animations We will need 3 files to help get us started at
HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.
Programming Games Google Map API examples. CSS. Classwork/homework: Catch up. Upload work. Show your [more] complex Google Maps API example. Plan your.
Programming Games Simulated ballistic motion: cannon ball. Classwork: Final day for midterm project and all projects for first part of class. Homework:
Programming Games Show your simple video. More video examples. Audio. Classwork/Homework: Produce more complex video program.
Programming games Reprise: coin toss on canvas. Dice game rules. Global and local variables. Homework: [Catch up. Upload projects, including index.html.]
Homework: New coin toss. [Start dice game.]
Programming Games Show project. Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Homework: Do your own.
Programming games Flash drawing trick(s). Past due: Your completion of rock-paper-scissors) Classwork: Bouncing ball: read tutorial. Start coding.
Programming games Show your version of Bo the dog. Start cannonball Preview: video, audio work session (cannonball) Homework: Cannonball with ball in a.
Programming Games Preview Video & Audio. Work on cannonball. Homework: finish cannonball!
Creating User Interfaces Recap HTML/HTML5 JavaScript features Homework: keep working on user observation studies. Review JavaScript.
Programming Games Reprise on drawing on canvas. Jargon (concepts): objects. Demonstrate slingshot. Mouse events. Work on your cannonball. Homework: Finish.
Programming Games [Show Google Maps project.] Demonstrate more examples. Classwork/Homework: Decide on final project. Post proposal to moodle.
HTML 5 Tutorial Chapter 3 Video. Video HTML 5.0 provides a standard for showing video. Using the element we can easily embed video within our web page.
CHAPTER 15 HTML 5 VIDEO AND AUDIO Intro to HTML5 1.
Programming games Context of what we are doing. Drawing on canvas. Homework: [Complete coin toss examples.] Do your own drawings. Upload files to website.
Programming games Review concepts. Crooked coin toss. Drawing on canvas. Homework: Complete [static] drawings. Upload files to website.
School of Computing and Information Systems RIA Animation, part I.
Programming Games Show slide show (on your site). Bouncing something. Video element. Bouncing video element. Bouncing video drawn on canvas. Bouncing video.
CS 200 Multimedia Objects in Web Pages. MultiMedia Objects Three primary types of multimedia objects  Audio  Video Includes Flash Objects  Images.
What is HTML5? HTML5 will be the new standard for HTML. The previous version of HTML, HTML 4.01, came in The web has changed a lot since then. HTML5.
Introduction of Presented by Neetu sharma MCA (8 th trim)
Programming games Show work on site. Work on slide show. Timed event for bouncing ball. Homework: [Finish slide show and upload to site.] Acquire a short.
HTML Structure & syntax
The HTML5 logo was introduced by W3C in 2010
Introduction to HTML.
Advanced HTML Tags:.
Chapter 4: Feature Detection & Drag and Drop
That Gauge is COOL! 
Chapter 4: HTML5 Media - <video> & <audio>
Programming Games [Show Google Maps project.] Demonstrate more examples. Classwork/Homework: Decide on final project. Post proposal to moodle. 1.
Playing Video (Part 2).
The Canvas.
Context of what we are doing.
Giuseppe Attardi Università di Pisa
Programming games Demonstrate cannonball
Programming games Share your plans for your virtual something.
Catchup. Work on project.
Creating User Interfaces
Programming Games Reprise on drawing on canvas. Jargon (concepts): objects. Demonstrate slingshot. Mouse events. Work on animation project. Homework: Finish.
Programming Games Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Show project. Classwork/Homework:
Show your animation project. HTML5 video. Miro.
Presentation transcript:

Creating User Interfaces HTML5 video & audio. Role of video and audio. Homework: Complete your own [small/simple] HTML5 video and audio projects.

Background on audio & video This is native support (no need for plugins), no dependence on YouTube. –But keep in mind that YouTube performs other functions storage ability for others to find your clips IF that is what you want Issue: Multiple formats (aka codecs) for each. –Different browsers recognize different formats. –Situation MAY improve: may be standardization. –Good news: the and elements provide way to reference multiple files and let browser choose (though order does seem to be important).

Audio & video elements

Our goal now Assume you have access to a video clip and an audio clip each in some format. Download Miro Converter and use this to produce other formats. Put audio into one of existing projects or standalone Put video into one of existing projects or standalone I will show other examples of video –video clip as reward –moving video element –drawImage(video, …) places video on canvas and re-draw with other drawings (mask) to see bouncing video ball.

Acquire video Make your own. Find on-line. Site lets you specify a URL and choose from the videos to download. –Respect intellectual property!!! –Respect personal privacy (of friends & family, etc.)!!!

Produce all formats Produce formats for all browsers: – Download the program. The original file can be in several different formats, including flv (Flash format, used by YouTube). Follow directions: should produce the 3 formats: mp4, theora.ogv, webmvp8.webm

Simple, static Video Put video element in your favorite sites or something else or ??? Test using Firefox, Chrome and Safari. PATIENCE!!

Video at precise time html5/quizmultiple.htmlhttp://faculty.purchase.edu/jeanine.meyer/ html5/quizmultiple.html Works best in Firefox. Use style: #vid {position:absolute; visibility:hidden; z- index: 0; } When round of game is complete, vid made visible.

Bouncing video Two versions –move around video element –use drawImage to place video on canvas (works in FireFox) Doing this makes it easier to draw mask. Otherwise, difficult to position. "Not quite ready for prime time". Need to put in code to wait until video all downloaded.

Strategy Use setInterval to invoke [my] drawscene function –re-position video. –Check against [virtual] walls. Apply angle of incidence equal angle of reflection (easy to do) –use strokeRect to draw box NOTE: the loop attribute did not work, so I set up event handling for video ended event.

Function table initCalled by action of onLoad in restart… addEventListener in init drawscene… setInterval in init. This is different in two versions moveandcheckCalled in drawscene

Bouncing video rectangle canvas and video distinct elements html5workshop/videobounce1.htmlhttp://faculty.purchase.edu/jeanine.meyer/ html5workshop/videobounce1.html

Video is in motion

Style section Positioning and layering (my term). Note: to change z-index by JavaScript, use zIndex. #vid {position:absolute; visibility:hidden; z-index: 0; } #canvas {position:absolute; z- index:10;}

var ctx; var cwidth = 900; var cheight = 600; var ballrad = 50; var boxx = 20; var boxy = 30; var boxwidth = 850; var boxheight = 550; var boxboundx = boxwidth+boxx-2*ballrad; var boxboundy = boxheight+boxy-2*ballrad; var inboxboundx = 0; var inboxboundy = 0; var ballx = 50; var bally = 60; var ballvx = 2; var ballvy = 4; var v;

function init(){ ctx = document.getElementById('canvas').getContext(' 2d'); v = document.getElementById("vid"); v.addEventListener("ended",restart,false); v.style.left = ballx; v.style.top = bally; v.width = 2*ballrad; v.height = 2*ballrad; v.play(); v.style.visibility = "visible"; setInterval(drawscene,50); }

function restart() { v.currentTime=0; v.play(); }

function drawscene(){ ctx.lineWidth = ballrad; ctx.clearRect(boxx,boxy,boxwidth,boxheight); moveandcheck(); v.style.left = ballx; v.style.top = bally; ctx.strokeStyle ="rgb(200,0,50)"; ctx.strokeRect(boxx,boxy,boxwidth,boxheight); //box }

function moveandcheck() { var nballx = ballx + ballvx; var nbally = bally +ballvy; if (nballx > boxboundx) { ballvx =-ballvx; nballx = boxboundx; } if (nballx < inboxboundx) { nballx = inboxboundx ballvx = -ballvx; } if (nbally > boxboundy) { nbally = boxboundy; ballvy =-ballvy; } if (nbally < inboxboundy) { nbally = inboxboundy; ballvy = -ballvy; } ballx = nballx; bally = nbally; }

Your browser does not accept the video tag. This browser doesn't support the HTML5 canvas element.

Bouncing video circle Works in Firefox. video used in drawImage. A mask is created: a box with a hole positioned over the video to produce a circular html5workshop/videobounce3.htmlhttp://faculty.purchase.edu/jeanine.meyer/ html5workshop/videobounce3.html

Video is in motion

Coding Pretty much the same code as before. Important to know when you can build on prior work! draw video on canvas and then draw a filled in path on canvas that is all white— with a circular hole letting some of video show.

var ctx; var cwidth = 900; var cheight = 600; var ballrad = 50; var boxx = 20; var boxy = 30; var boxwidth = 850; var boxheight = 550; var boxboundx = boxwidth+boxx-2*ballrad; var boxboundy = boxheight+boxy-2*ballrad; var inboxboundx = 0; var inboxboundy = 0; var ballx = 50; var bally = 60; var ballvx = 2; var ballvy = 4; var maskrad; var v;

function init(){ ctx = document.getElementById('canvas').getContext(' 2d'); v = document.getElementById("vid"); v.addEventListener("ended",restart,false); // because loop doesn't work on FF v.width = v.videoWidth/3; v.height = v.videoHeight/3; videow = v.width; videoh = v.height; maskrad =.4*Math.min(videow,videoh); v.play(); setInterval(drawscene,50); }

function restart() { v.currentTime=0; v.play(); }

function drawscene(){ ctx.lineWidth = ballrad; ctx.clearRect(0,0,boxwidth+boxx,boxheight+boxy); ctx.fillStyle="rgb(255,255,255)"; //white moveandcheck(); ctx.drawImage(v,ballx+boxx, bally+boxy, v.width,v.height); ctx.beginPath(); ctx.moveTo(ballx+boxx,bally+boxy); ctx.lineTo(ballx+boxx+v.width,bally+boxy); ctx.lineTo(ballx+boxx+v.width,bally+boxy+v.height); ctx.lineTo(ballx+boxx,bally+boxy+v.height); ctx.lineTo(ballx+boxx,bally+boxy); ctx.arc(ballx+boxx+.5*v.width,bally+boxy+.5*v.height,maskrad,0, Math.PI*2,true); ctx.fill(); //draw white mask on top of video, letting just circle show ctx.strokeStyle ="rgb(200,0,50)"; ctx.strokeRect(boxx,boxy,boxwidth,boxheight); //box }

function moveandcheck() { var nballx = ballx + ballvx; var nbally = bally +ballvy; if (nballx > boxboundx) { ballvx =-ballvx; nballx = boxboundx; } if (nballx < inboxboundx) { nballx = inboxboundx ballvx = -ballvx; } if (nbally > boxboundy) { nbally = boxboundy; ballvy =-ballvy; } if (nbally < inboxboundy) { nbally = inboxboundy; ballvy = -ballvy; } ballx = nballx; bally = nbally; }

Your browser does not accept the video tag. This browser doesn't support the HTML5 canvas element.

Homework Complete your video and audio projects. Prepare to present.