こんにちは。動画サイトvimeoのAPIから、
チャプターの情報を取得して、ワードプレス上に表示したいと思っています。
vimeoAPIでは、
This method gets the chapters of the video as an array.
Each chapter object looks like this:
{
"startTime": 15,
"title": "Chapter Title",
"index": 1
}
getChapters() Returns Promise <array, Error>
と書かれており、オブジェクトが格納されているんだと解釈して、
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> <script src="https://player.vimeo.com/api/player.js"></script> <div id="edit_area"></div> <script> $(function() { // プレーヤーのオプション設定 var iframe = document.querySelector('iframe'); var player = new Vimeo.Player(iframe); player.getChapters().then(function(chapters) { var chapter = chapters.title ; document.getElementById('edit_area').innerHTML = chapter ; }).catch(function(error) { switch (error.name) { case 'UnsupportedError': // Autopause isn't supported by the current player or browser break; default: // Some other error occurred break; } }); </script>
など、色々と試してみましたが、
「undefined」や「<Object,object>」としか表示されません。
何が間違っているのでしょうか?
ご教授よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー