<!DOCTYPE html>
<html lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.5">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<title>Test</title>
</head>
<body>
<video controls onerror="VideoOnError()"></video>
<input type="file" onchange="InputFileChange()" multiple>
<select onchange="SelectFileChange()">
<option selected hidden disabled>Список видео</option>
</select>
<script>
function VideoOnError(e)
{
alert("Ошибка " + e.target.error.code);
}
function InputFileChange()
{
for (var i = 0; i < document.querySelector("input").files.length; i++)
{
var VarOpt = document.createElement("option");
VarOpt.text = document.querySelector("input").files[i].name;
//VarOpt.id = webkitURL.createObjectURL(document.querySelector("input").files[i]);
VarOpt.id = "/var/mobile/Media/DCIM/100APPLE/" + document.querySelector("input").files[i].name;
VarOpt.value = document.querySelector("input").files[i].name;
document.querySelector("select").add(VarOpt);
}
}
function SelectFileChange()
{
document.querySelector("video").src = document.querySelector("select")[document.querySelector("select").selectedIndex].id;
}
</script>
</body>
</html>
function SelectFileChange()
{
var file = document.querySelector("input").files[document.querySelector("select").selectedIndex];
var reader = new FileReader();
reader.onload = function(e) {
document.querySelector("video").src = e.target.result;
};
reader.onerror = function(e)
{
alert("Ошибка " + e.target.error.code);
}
reader.readAsDataURL(file);
}
Значение id не поменялось.