play avi file

I’m trying to write program a C++ program that will detect color with the webcam.
It depends on 6 conditions (colors red, blue, green…), which movie is shown…

if color = red then
play film1.avi

Can somebody please help me with playing avi file in fullscreen mode and enough fast?
Anybody can help me with the code or show me some link to a tutorial?

Best Regards!