mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
5.0 KiB
5.0 KiB
Media
Overview
API Calls interacting with Plex Media Server Media
Available Operations
- markPlayed - Mark Media Played
- markUnplayed - Mark Media Unplayed
- updatePlayProgress - Update Media Play Progress
markPlayed
This will mark the provided media key as Played.
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
use \LukeHagar\Plex_API\Models\Operations;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->media->markPlayed(59398);
if ($response->statusCode === 200) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key |
float | ✔️ | The media key to mark as played | 59398 |
Response
?\LukeHagar\Plex_API\Models\Operations\MarkPlayedResponse
markUnplayed
This will mark the provided media key as Unplayed.
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
use \LukeHagar\Plex_API\Models\Operations;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->media->markUnplayed(59398);
if ($response->statusCode === 200) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key |
float | ✔️ | The media key to mark as Unplayed | 59398 |
Response
?\LukeHagar\Plex_API\Models\Operations\MarkUnplayedResponse
updatePlayProgress
This API command can be used to update the play progress of a media item.
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
use \LukeHagar\Plex_API\Models\Operations;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->media->updatePlayProgress('string', 6900.91, 'string');
if ($response->statusCode === 200) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key |
string | ✔️ | the media key |
time |
float | ✔️ | The time, in milliseconds, used to set the media playback progress. |
state |
string | ✔️ | The playback state of the media item. |
Response
?\LukeHagar\Plex_API\Models\Operations\UpdatePlayProgressResponse