Muskets were a firearm used for over two centuries in several armed conflicts including the Civil War. In the video below you can see a demonstration of the firing of a musket in slow motion at the fort of the Fort Frederick State Park in Maryland.
The firing mechanism of the musket relies on a hammer (cock) that contains a piece of flint rock attached to its end. The hammer is pulled back into a position of tension (cocked position) thanks to a spring mechanism. When the hammer is released by operating the trigger, its flint head hits a structure called the frizzen, pushing it back and generating a spark that ignites a small amount of gunpowder under the frizzen in a space called a flash or priming pan.
In the video below, this is the first explosion that you see near the rear of the musket. Once the flash pan has ignited, the flame travels through a touch hole or vent and ignites the powder within the barrel of the musket, which results in the firing of the projectile. This is the second explosion in the video which comes out of the muzzle of the musket. You can even hear an echo of the explosion from the sound bouncing off the barracks and walls of the fort.
Image of the firing mechanism of a musket by Jim Surkamp is used here under an Attribution-NonCommercial 2.0 Generic (CC BY-NC 2.0) license.