Constrained Locator in Wolfram Player?

I’m not sure if this is properly a question about Wolfram Player or is just my use of the Wolfram Language causing problems.

I’ve created a dynamic graphic with a constrained locator just fine in Mathematica. However, it fails when opened/previewed in Player. See attached notebook - the top, unconstrained example works just fine in Player but the second, constrained example does not. Is there a workaround of some sort here?

I realize that in this particular example I could simply use Manipulate, but a general Player-compatible approach would be valuable to me.

Thanks.

locator-player.nb (5.97 KB)

It works in Player if the constraints definition is made to be within the DynamicModule:

DynamicModule[
  {pt={0.5,0},constrain},
  constrain[{x_,y_}]:={Piecewise[{{0,x<0},{x,0<=x<=1},{1,x>1}}],0};
  Graphics[
    {
    {Thick,Circle[]},
    Line[{{0,0},Dynamic[pt]}],
    Locator[Dynamic[pt,(pt=constrain[#])&]]
    },
    PlotRange->1.1
  ]
]

Oh, beautiful! Of course that makes sense… I even suspected that we were just lacking the definition but didn’t think to add it to DynamicModule’s initialization list. Duh.

Thank you so much!