无法使用dailymotion api获取私人视频的iframe代码


Unable to get the iframe code for a private video with dailymotion api

我需要嵌入一个私人dailymotion视频'dailymotion-sdk-php'。我创建了一个帐户,并添加了密钥和密码。但在iframe内,我只得到'私人内容'消息。

这是我的代码

<?php 
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 1);
set_time_limit(0);
$apiKey = 'my key';
$apiSecret = 'my secret';
require_once 'Dailymotion.php';
// Instanciate the PHP SDK.
$api = new Dailymotion();
// Tell the SDK what kind of authentication you'd like to use.
// Because the SDK works with lazy authentication, no request is performed at this point.
$api->setGrantType(Dailymotion::GRANT_TYPE_AUTHORIZATION, $apiKey, $apiSecret);
// $api = new Dailymotion();
try
{
$result = $api->get(
'/video/my id',
array('fields' => array('id', 'title', 'owner'))
);
}
catch (DailymotionAuthRequiredException $e)
{
echo $e->getMessage();
// If the SDK doesn't have any access token stored in memory, it tries to
// redirect the user to the Dailymotion authorization page for authentication.
return header('Location: ' . $api->getAuthorizationUrl());
}
catch (DailymotionAuthRefusedException $e)
{
echo $e->getMessage();
// Handle the situation when the user refused to authorize and came back here.
// <YOUR CODE>
}
trace($result);
function trace($d) {
echo '<pre>';
var_dump($d);
echo '</pre>';
echo '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/my id"></iframe>';
}
?>

如果有人能帮我把这个归档就太好了

当你有一个私人视频,你想把它嵌入到你的网站,你需要这样做与它的私人id。API将在private_id字段下返回此id(您需要作为视频的所有者进行身份验证)。此外,您可以使用embed_url直接获得嵌入url,或者您甚至可以获得embed_html

你可以使用的API调用示例:https://api.dailymotion.com/video/ID?fields=embed_html embed_url、私人private_id& access_token =标记

在https://developer.dailymotion.com/api/faq#difference-private-public-videos获取更多关于私人视频的信息

注意:当你嵌入一个私有视频时,你会公开它的私有id。注意,视频不再是完全私人的,因为任何人都可以得到这个id!