如何使用Youtube API检测iframe视频是否结束?

时间:2018-01-27 13:01:18

标签: javascript php jquery iframe youtube-api

我想知道如何使用youtube API检测iframe视频何时结束。 我已设法使用此脚本打印视频的持续时间:

    $dur = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=contentDetails&id=" . $video_id['v'] . "&key=" . $key);

$duration =json_decode($dur, true);
foreach ($duration['items'] as $vidTime) {
    $vTime= $vidTime['contentDetails']['duration'];
    echo $vTime;
}

现在我需要检测iframe视频何时结束。你知道我怎么能这样做吗? 谢谢你的任何建议。

0 个答案:

没有答案
相关问题