muxinc / mux-php

Official Mux API wrapper for PHP projects, supporting both Mux Data and Mux Video.
MIT License
40 stars 30 forks source link

Invalid value for PlaybackPolicy #72

Open BlueBazze opened 1 year ago

BlueBazze commented 1 year ago

I am not entirely sure what is going on. It should be the exact same code as written in the example. I have tried to hardcode "public" instead of PlaybackPolicy::_PUBLIC but it gave the exact same error.

My code

$playbackRequest = new CreatePlaybackIDRequest([
    'policy' => PlaybackPolicy::_PUBLIC
]);
$playbackID = app('mux')->createAssetPlaybackId(
    $broadcast->source->muxAssetId,
    $playbackRequest
);

The error log

[2023-08-30 10:45:34] staging.ERROR: Invalid value for enum '\MuxPhp\Models\PlaybackPolicy', must be one of: 'public', 'signed' {"userId":4,"exception":"[object] (InvalidArgumentException(code: 0): Invalid value for enum '\\MuxPhp\\Models\\PlaybackPolicy', must be one of: 'public', 'signed' at /home/.../vendor/muxinc/mux-php/MuxPhp/ObjectSerializer.php:97)
[stacktrace]
#0 /home/.../vendor/muxinc/mux-php/MuxPhp/Api/AssetsApi.php(625): MuxPhp\\ObjectSerializer::sanitizeForSerialization(Object(MuxPhp\\Models\\CreatePlaybackIDRequest))
#1 /home/.../vendor/muxinc/mux-php/MuxPhp/Api/AssetsApi.php(422): MuxPhp\\Api\\AssetsApi->createAssetPlaybackIdRequest('...', Object(MuxPhp\\Models\\CreatePlaybackIDRequest))
#2 /home/.../vendor/muxinc/mux-php/MuxPhp/Api/AssetsApi.php(404): MuxPhp\\Api\\AssetsApi->createAssetPlaybackIdWithHttpInfo('...', Object(MuxPhp\\Models\\CreatePlaybackIDRequest))
#3 /home/.../app/Services/Mux/Assets.php(15): MuxPhp\\Api\\AssetsApi->createAssetPlaybackId('...', Object(MuxPhp\\Models\\CreatePlaybackIDRequest))

The example i followed https://github.com/muxinc/mux-php/blob/master/examples/video/exercise-assets.php#L74-L75