In Spain.
There is a mistake.
a) When it's followed by e and i, it sounds like h in hot. There is no exception, so when following the letter "n", like in "angina" or "ingenio" or "un genio", the "g" is pronunciated like a "j"
b) When it's followed by a,o,u, and when it's gue or gui, the Spanish "g" closely resembles the "g" in the word "got."
b1) After a pause or a "n" or "m", it is an occlusive.
b2) If not after a pause or a "n" or "m, it is a fricative consonant. The difference between b1) and b2) resembles the difference between the "v" of "enviar" y "la vida"