Make custom API endpoint and move the logic from your PHP file into there instead
For example, the code below will create an endpoint in /wp-json/my/v1/video/<id>
add_action( 'rest_api_init', function() {
register_rest_route( 'my/v1', '/video/(?P<id>\d+)', [
'methods' => 'GET',
'callback' => 'get_video_data',
'permission_callback' => '__return_true',
] );
} );
function get_video_data( $params ) {
$video_id = $params['id'];
// do something like calling the DB where your video data is stored
// you can use custom post type to store the data
return $video_id;
}