本文整理匯總了TypeScript中ts/opg.api.findVideoMeta方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript api.findVideoMeta方法的具體用法?TypeScript api.findVideoMeta怎麽用?TypeScript api.findVideoMeta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ts/opg.api
的用法示例。
在下文中一共展示了api.findVideoMeta方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
$('#btnUpFilePath').click(function () {
let mediaPath = iptVideoFile.val();//.replace(/\\/g , '/');
if (mediaPath) {
opg.api.findVideoMeta({mediaPath}, (data) => {
cachedMediaPath = mediaPath;
streams = data.streams;
//
let streamsHash = {}, streamHtml: string = '';
streams.map((stream, i) => {
let type = stream['codec_type'];
let entry = streamsHash[type];
if (!entry) {
streamsHash[type] = [stream];
}
else {
entry.push(stream);
}
streamHtml += `<table class="search-table" style="margin-bottom: 2em; "><tbody>`;
for (let key in stream) {
streamHtml += `<tr><td class="lead">${key}</td><td>${stream[key]}</td></tr>`
}
streamHtml += `</tbody></table>`;
});
//視頻
let videoArr = streamsHash['video']||[];
videoArr.forEach((item) => {
item.title = item.title ? item.title : (item.language ? item.language : item.index);
});
opg('#videoTrack').listBox({
data: videoArr,
text: 'title',
value: 'index',
autoPrependBlank: false,
onSelect : function () {
videoFrames = this.selectedData.frames;
}
});
//音頻
let audioArr = streamsHash['audio']||[];
audioArr.forEach((item) => {
item.title = item.title ? item.title : (item.language ? item.language : item.index);
});
opg('#audioTrack').listBox({
data: audioArr,
text: 'title',
value: 'index',
autoPrependBlank: false,
});
//字幕
let subtitleArr = streamsHash['subtitle']||[];
subtitleArr.forEach((item) => {
item.title = item.title ? item.title : (item.language ? item.language : item.index);
});
opg('#subtitleTrack').listBox({
data: subtitleArr,
text: 'title',
value: 'index',
autoPrependBlank: false,
});
//詳情
let tdDetails = $('#tdDetails');
let aExpand = $('#aExpand').click(function () {
let a = $(this);
if (a.hasClass('expanded')) {
$(this).removeClass('expanded').text('(展開)');
tdDetails.html('<span class="text-light-gray">詳情已折疊,點擊展開 ...</span>');
}
else {
$(this).addClass('expanded').text('(收起)');
tdDetails.html(streamHtml);
}
});
tdDetails.on('click', '.text-light-gray', function () {
aExpand.trigger('click');
});
//duration
if(data.format && data.format.duration)
duration = data.format.duration ;
$('#tbdProfile').show();
});
}
else {
iptVideoFile.iptError('視頻路徑不可為空');
}
});