On my website there is a youtube api player and users can watch the video by entering the link in the input field. everything works fine from the computer where the program itself is located. But I can’t play the video from other devices.
I thought it might be a cookie problem because every time I tried to upload a video from my phone, awarning message popped up.
Is the problem with playing videos really related to cookies? If yes, how can this be fixed in asp.net core 7?
I'm a newbie, so don't judge me harshly if I said something wrong
function loadVideoPlayer (){ player = new YT.Player('player', { height: '360', width: '640', events: {'onReady': onPlayerReady,'onStateChange': onPlayerStateChange, }, playerVars: {'origin': 'https://192.168.1.39:7269' }, });}// 4. The API will call this function when the video player is ready.function onPlayerReady(event) { event.target.playVideo();}// 5. The API calls this function when the player's state changes.// The function indicates that when playing a video (state=1),// the player should play.var done = false;function onPlayerStateChange(event) { if (event.data == YT.PlayerState.PLAYING && !done) { done = true; }}function stopVideo() { player.stopVideo();}document.getElementById("videoSrc").addEventListener("click", function () { var userVideoUrl = document.getElementById("userUrl").value; var userVideoId = getVideoId(userVideoUrl); if (userVideoId == "") { alert('Enter correct url!'); } else { connection.invoke("SendVideoData", userVideoId).catch(function (err) { return console.error(err.toString()); }); }});connection.on("ReceiveVideoData", function (userVideoId) { player.loadVideoById(userVideoId);});function getVideoId(url) { var videoId = ""; if (url.indexOf("youtube.com") !== -1) { videoId = url.split("v=")[1]; } else if (url.indexOf("youtu.be") !== -1) { videoId = url.split(".be/")[1]; } return videoId;}