Plan beyond the train arrival
The tourism association lists the Kuroshio limited express from the Kyoto, Shin-Osaka, Osaka and Tennoji side, with a bus or taxi onward from Shirahama. Compare your actual departure station and dated connection rather than borrowing a single Osaka-to-Shirahama journey time from a video.
Check the return train before arranging the last coastal stop. Include the ride back to the station, waiting and finding the correct platform. If arriving late enough that this squeezes the visit, choose fewer stops or compare an overnight stay.