組件化,提供插入視頻功能,本地視頻,網絡視頻鏈接
問題
1:該編輯器方案下,<video src="xxx" poster="" ... /> poster封面不顯示
2:資源在沙盒/tmp目錄下,視頻播放三角形圖標不顯示
實現
封面問題
var html = ' <video controls="controls" src="'+url+''+"?#t=0.000001"+'" '+style1+' ></video><br></br>';
document.execCommand('insertHTML', false, html);
在視頻鏈接src後面拼接?#t=time,具體最小敏感粒度多大不知道,儘量小唄,因爲這個時間點也就是視頻開始播放的時間點:t=0.000001
這個方案可能不好,但是其他方案也試了,但都沒有效果,比如:
var video=document.getElementById("video");//video標籤對象
video.οncanplay=function(){
$("#video").attr("poster","https://www.xxt.cn/xxt_index/image/open-xxt.png");
window.location = "";
zss_editor.enabledEditingItems();
}
document.getElementById("video").addEventListener('loadeddata',cut);
var cut = function() {
var canvas = document.createElement("canvas");//創建畫布
canvas.width = video.videoWidth * scale;
canvas.height = video.videoHeight * scale;//設定寬高比
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);//將視頻此刻幀數畫入畫布
var img = document.createElement("img");
img.src = canvas.toDataURL("image/png");
Dom.appendChild(img);//寫入到Dom
};
播放圖標不顯示問題
偶現
求教,一直妹解決這個問題,html資源在bundle中的時候是正常的,都放到沙盒裏後就這了
ios 編輯器1-基於WKWebview的編輯器技術方案
ios 編輯器2-基於wkwebview編輯器加載本地html資源
ios 編輯器3-基於wkwebview編輯器插入網絡圖片不顯示問題