武经总要
According to the "Wujing Zongyao", gunpowder was used to ignite the flamethrower: