Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $i = 0;
- if ( !count($plex_session_xml->Video) == 0 ) {
- // Someone is watching, get their progress
- foreach($plex_session_xml->Video as $plex_session) {
- $i++; // Increment i every pass through the array
- $duration = $plex_session[$i - 1]['duration'];
- $viewOffset = $plex_session[$i - 1]['viewOffset'];
- $progress = sprintf('%.0f', ($viewOffset / $duration) * 100);
- $progress_array = [
- "progress" => $progress,
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement