Kollus Player Include Intro & Outro

비디오 영상 재생 시 본 영상 이전 5초 Pre-Roll과 본 영상 종료 후 Post-Roll 연결과 관련된 샘플입니다. 

 

<Example code>

<?php /** * base64_urlencode * * @param string $str * @return string */ function base64_urlencode($str) { return rtrim(strtr(base64_encode($str), '+/', '-_'), '='); } /** * jwt_encode * * @param array $payload * @param string $key * @return string */ function jwt_encode($payload, $key) { $jwtHead = base64_urlencode(json_encode(array('typ' => 'JWT', 'alg' => 'HS256'))); $jsonPayload = base64_urlencode(json_encode($payload)); $signature = base64_urlencode(hash_hmac('SHA256', $jwtHead . '.' . $jsonPayload, $key, true)); return $jwtHead . '.' . $jsonPayload . '.' . $signature; } $securityKey = 'SECURITY_KEY'; $customKey = 'CUSTOME_KEY'; $mediaContentKeyIntro = 'MEDIA_CONTENT_KEY_INTRO'; $mediaContentKey = 'MEDIA_CONTENT_KEY'; $mediaContentKeyOutro = 'MEDIA_CONTENT_KEY_OUTRO'; $clientUserId = 'CLIENT_USER_ID'; $expireTime = 7200; // 120 min $mediaItems = array( array( 'media_content_key' => $mediaContentKeyIntro, ), array( 'media_content_key' => $mediaContentKey, ), array( 'media_content_key' => $mediaContentKeyOutro, ), ); $payload = array( 'mc' => array(), 'cuid' => $clientUserId, 'expt' => time() + $expireTime, ); foreach ($mediaItems as $mediaItem) { $mcClaim = array(); $mcClaim['mckey'] = $mediaItem['media_content_key']; $payload['mc'][] = $mcClaim; } $jwtToken = jwt_encode($payload, $securityKey); $webTokenURL = 'http://v.kr.kollus.com/s?jwt=' . $jwtToken . '&custom_key=' . $customKey; ?> <!DOCTYPE html> <html lang="en"> <body> <iframe width="840" height="472" src="<?php echo $webTokenURL; ?>" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe> </body> </html>

 






Copyright © CATENOID, lnc. All Rights Reserved.
E-mail. support@catenoid.net | Tel. 1544-4367