是否可以创建一个包含多个视频的开始和结束时间的嵌入网址;像下面吗?
http://www.youtube.com/embed/VTNSdABrKAI?start=134&end=225/embed/I4LoGhyb2uc?start=172&end=257
因此,下一个剪辑将在同一视频帧中播放,而不是在网页上放置多个嵌入URL;
http://www.youtube.com/embed/VTNSdABrKAI?start=134&end=225
http://www.youtube.com/embed/I4LoGhyb2uc?start=172&end=257
或者避免创建,编辑并上传整个YouTube新视频并处理以下版权声明?
Youtube允许您在频道上选择programmatically create playlists,然后选择add items to playlists。playlistItems/insert
调用还允许您为剪辑提供specify,position
,startAt
和endAt
属性,这似乎涵盖了您的用例。
使用此API的一个警告-您必须为registered with them to use it
播放列表可以包含up to 200 videos
UPD我运行了以下API请求,并能够成功创建a playlist。
curl --request POST \
'https://www.googleapis.com/youtube/v3/playlists?part=snippet%2Cstatus&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"snippet":{"title":"Sample playlist created via API","description":"This is a sample playlist description."},"status":{"privacyStatus":"unlisted"}}' \
--compressed
curl --request POST \
'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"snippet":{"playlistId":"PL5W0uIHD5lLZAK1reCuTDFpGMPygNDWvm","position":0,"resourceId":{"kind":"youtube#video","videoId":"PLOPygVcaVE"}},"contentDetails":{"videoId":"PLOPygVcaVE","startAt":"PT4H37M0.000S","endAt":"PT4H38M0.000S"}}' \
--compressed
curl --request POST \
'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"snippet":{"playlistId":"PL5W0uIHD5lLZAK1reCuTDFpGMPygNDWvm","position":1,"resourceId":{"kind":"youtube#video","videoId":"L_LUpnjgPso"}},"contentDetails":{"videoId":"L_LUpnjgPso","startAt":"PT8H37M0.000S","endAt":"PT8H38M0.000S"}}' \
--compressed
但是,Youtube似乎有deprecated,contentDetails.startAt
和contentDetails.endAt
,我建议您依靠它:开始时间似乎仍然有效,但是剪辑一直播放到结束。
[我建议您从this SO thread中检查建议-您也许可以从那里的答案中利用某些想法(例如,在播放器中使用第三方或Javascript事件)