O'Reilly Forums: Videobooth Effects Do Not Work - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Videobooth Effects Do Not Work downloaded code doesn't work

#1 User is offline   Seth Close 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-February 12

Posted 10 February 2012 - 12:21 PM

The processFrame function has some issues with it. I even tried running the downloaded code directly, and it still does not work. Has no one else picked up on this?

On page 397, there is the processFrame function. I find that it fails when trying to retrieve the frame.data.length.

Also, note other errors:

"buffer.drawImage(video... , bufferCanvas.width, displayCanvas.height);"

This should use "bufferCanvas.height", as it is on the previous page.

"for (var i=0; i<length; i++)"

This should use "i+=4", since each loop goes through 4 pixels.

I looked around online and can't figure out why that length is not being calculated correctly.

Oh, also, loop doesn't work on the downloaded version either. I thought it was because of how we were not handling it in the endedHandler, but it wasn't.

This post has been edited by Seth Close: 10 February 2012 - 12:37 PM

0

#2 User is offline   Beth Robson 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Employee
  • Posts: 320
  • Joined: 17-September 08
  • Gender:Female
  • Location:Seattle, WA
  • Interests:I am interested in computer science, the Web, social media and the internet, Mac development, and adult learning.

Posted 11 February 2012 - 03:32 PM

First, the displayCanvas and the bufferCanvas are the same height, so it should work (although you're right, it's an error in the book).

Next, you want to leave the loop as it is, that is, i++, not i+4. Because we're using i as a multiplier into each part of the array, if you try it out on i = 0, i = 1, i = 2, you'll see that it does the right thing.

Sounds like there might be an issue with the current version of Firefox with the frame.data.length, so try another browser.

Elisabeth
Elisabeth Robson
Co-founder, WickedlySmart.com
Author: Head First HTML5 Programming, Head First HTML and CSS, Head First Design Patterns
0

#3 User is offline   Stephen Harris 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 05-June 12

Posted 05 June 2012 - 07:52 AM

I cannot get the effects to work either on my mac.
I have tried firefox and safari.

I have used the downloaded code for the book and placed it in localhost.

It works fine until we come to the effects. Then nothing works.
0

#4 User is offline   Beth Robson 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Employee
  • Posts: 320
  • Joined: 17-September 08
  • Gender:Female
  • Location:Seattle, WA
  • Interests:I am interested in computer science, the Web, social media and the internet, Mac development, and adult learning.

Posted 05 June 2012 - 04:17 PM

Stephen,
Can you check the developer console and see if you are getting errors?

Thanks

Elisabeth
Elisabeth Robson
Co-founder, WickedlySmart.com
Author: Head First HTML5 Programming, Head First HTML and CSS, Head First Design Patterns
0

#5 User is offline   Stephen Harris 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 05-June 12

Posted 07 June 2012 - 03:35 AM

Yes I am, they are rather long but there are 3 and they all include the words:
XMLHttpRequest cannot load http://rapport-daishi-request-2/. Origin http://192.168.0.3 is not allowed by Access-Control-Allow-Origin.

I am using Safari and using my local site.
0

#6 User is offline   Jimzy 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 31-January 13

Posted 31 January 2013 - 03:06 PM

Was there a solution to this problem?
0

#7 User is offline   Beth Robson 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Employee
  • Posts: 320
  • Joined: 17-September 08
  • Gender:Female
  • Location:Seattle, WA
  • Interests:I am interested in computer science, the Web, social media and the internet, Mac development, and adult learning.

Posted 31 January 2013 - 04:17 PM

View PostStephen Harris, on 07 June 2012 - 03:35 AM, said:

Yes I am, they are rather long but there are 3 and they all include the words:
XMLHttpRequest cannot load http://rapport-daishi-request-2/. Origin http://192.168.0.3 is not allowed by Access-Control-Allow-Origin.

I am using Safari and using my local site.


Ah yes, this is the cross-origin problem with XMLHttpRequest. You must download your files from the same place where you are serving your HTML and JavaScript, so that means all the files must be on the SAME machine. We explain this problem in detail in the book.
Elisabeth Robson
Co-founder, WickedlySmart.com
Author: Head First HTML5 Programming, Head First HTML and CSS, Head First Design Patterns
0

#8 User is offline   Beth Robson 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Employee
  • Posts: 320
  • Joined: 17-September 08
  • Gender:Female
  • Location:Seattle, WA
  • Interests:I am interested in computer science, the Web, social media and the internet, Mac development, and adult learning.

Posted 31 January 2013 - 04:17 PM

View PostJimzy, on 31 January 2013 - 03:06 PM, said:

Was there a solution to this problem?


The XHR domain problem? Yes, it's explained in the book in detail. Do you have a specific question about it?
Elisabeth Robson
Co-founder, WickedlySmart.com
Author: Head First HTML5 Programming, Head First HTML and CSS, Head First Design Patterns
0

#9 User is offline   Micro-BIOS 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 14-February 13

Posted 14 February 2013 - 11:18 AM

It didn't work from file:// but I could manage to setup IIS 7.5 Express, configure mime-types, and finally it worked from http://localhost/
0

#10 User is offline   macs054 

  • New Member
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 07-April 13

Posted 07 April 2013 - 01:55 AM

I still can't get the effects to work. I've tried using other browsers and opening it at localhost, but it still doesn't work. I've also tried using the downloaded code but is also doesn't work.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users