Media Player control with C++

I know that I can use variable for reference to control media player like play, pause, but is it possible to do it in C++? If so, how do I get the reference? Thanks

Iterate through your Media Players, select the one you want by name, then do the functions needed for that:

for (TObjectIterator<UMediaPlayer> ActorItr; ActorItr; ++ActorItr)
	{
UE_LOG(LogTemp, Warning, TEXT("Found an media player! %s"), *ActorItr->GetName());
}

Project.Build.CS,Add MediaAssets Module,can Compile Success