首先,我是編程中的新手。我讀過幾乎所有類似的主題,但我無法弄清楚我的情況有什麼不對。我運行下面的代碼使用本地主機服務器(XAMPP)和可拖動選項工作正常,但不能調整大小。可拖動的作品可調整大小不是
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Learning WebRTC - Chapter 2: Get User Media</title>
<link rel="stylesheet" href="jquery-ui-1.12.0.custom/jquery-ui.min.css">
<script src="jquery-ui-1.12.0.custom/external/jquery/jquery.js"></script>
<script src="jquery-ui-1.12.0.custom/jquery-ui.min.js"></script>
<style type="text/css">
.student {
width: 180px;
height: 180px;
}
</style>
</head>
<body>
<video class="student" autoplay></video>
<script src="main.js"></script>
<script>
$(document).ready(function() {
$(".student").resizable().draggable();
});
</script>
</body>
</html>
main.js
function hasUserMedia() {
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia
|| navigator.mozGetUserMedia || navigator.msGetUserMedia);
}
if (hasUserMedia()) {
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
navigator.msGetUserMedia;
navigator.getUserMedia({ video: true, audio: true }, function
(stream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(stream);
}, function (err) {});
} else {
alert("Sorry, your browser does not support getUserMedia.");
}
測試在這裏,它似乎Draggable工作:https://jsfiddle.net/Twisty/f0resov1/ – Twisty