I know that both sentences can be used to express proximity, to be near something but "by" sounds much better to me than "at" in this case. In which situation is "at" preferable?
I would use "by the river" to indicate their location if their play is incidental to the fact that the river exists. For example, "They meet by the river every afternoon to play chess. On the other hand, if the presence of the river is fundamental to their activity I might use another preposition. A second example, "They meet every afternoon at the river to fish." Like many preposition questions, the difference is subtle and, sometimes, ineffable. "I have a house at the lake and you are welcome to visit and go fishing or swimming," paints a different image than "I have a house by the lake and at dawn it is bathed in the most beautiful golden light." Here we have the same house located in the same place but the selection of prepositions depends on the tone of the remark.
Like many things, this depends on context; both are correct, but they have slightly different meanings.
"They're playing by the river" - I would understand you to mean that they (presumably children) are at a playground at or near the riverbank. I would also understand you to mean that they aren't actually going into the water.
"They're playing at the river" - Here in Southern California, I hear this phrase fairly often. It usually means that they (adults and/or children) have traveled to the Colorado River and are enjoying various water-related activities - waterskiing, whitewater rafting, innertubing, etc. - in addition to camping next to the river.
In other parts of the world, "the river" in question would obviously be different! However, I think that the distinction between by meaning "close to, but not in" and at meaning "in and around" will hold in most locales.
Also, the distinction between children playing by the river, and all ages playing at the river may be restricted to Southern California; many adults are reluctant to refer to their recreational activities as "playing"...
It depends on what you are trying to say. Are they near the river at any point? You should use by the river.