Wujing Zongyao
According to the "Wujing Zongyao", gunpowder was used to ignite the flamethrower: