Afaik both encoding and decoding require a license. However there is a mutual agreement from patent holders that there is no license required for FOSS decoders, allowing things like VLC to function without a license.
To expand a bit: mp3 decoding in JavaScript has been done, and it works pretty well, but not perfectly / not on all files. I've used it and stuff derived from it with quite satisfactory results in situations where I can control all of the inputs it will be used with. Adding basic support for mp3 decoding to this could be just a matter of integrating JSMad, if that's the way they felt like going about it, but adding really robust, efficient, gonna work all the time support would require a significant investment of additional effort.
I don't know what the state of the art is for mp3 encoding in JavaScript, if there is one.