A nicely original question! Most folks focus on the "To be or not to be" soliloquy and forget that there are others.
The players have come to court, and seeing them sparks an inspiration for Hamlet: to put on a play to test his uncle's virtue. However, let me start at the beginning.
The soliloquy starts by Hamlet musing on how amazing it is that actors can move people to real emotion, since they are just playing and in many cases the plays are about things that have nothing to do with the audience. (This is the "Hecuba" sequence.) In part, then, the meaning of this is a kind of commentary on the play itself, and on theater itself.
From reflecting on the actors' ability, Hamlet moves to thinking about his own inability, in this case to get justice for his father. He calls himself a coward, and verbally lashes himself for failing to produce justice/vengeance for his father's murder.
This brings him to the idea of putting on a play to prod his uncle's conscience, with the purpose of showing that he is in fact guilty of this hideous crime.
Ah! Good stuff.