function updatePlayer() {
		// If the stream URL input is different than the last saved one and is not just "https://" (which is 8 chars long)
		if (streamURLElement.value !== streamURL && streamURLElement.value.toString().length > 8) {
			// Reload gameFrame frame
			gameFrameElement.src = ""; // Clear src of gameFrame frame
			gameFrameElement.src = defaultGameURL; // Set src back to default game URL

			// Update the streamURL variable with the entered stream URL
			streamURL = streamURLElement.value;

			// If there is a stream URL entered
			if (streamURL != "") {
				document.title = `${documentTitle} - ${streamURL}`; // Update document title
				playerURL.searchParams.set("streamURL", streamURLElement.value); // Add stream URL as a param to the player URL
				window.history.pushState(null, null, "?streamURL=" + encodeURIComponent(streamURL)); // Add the streamURL to the window URL and log in history
			}
			// Else it is empty
			else {
				document.title = `${documentTitle}`; // Update document title
				playerURL.searchParams.delete("streamURL"); // Delete streamURL param from the player URL
				window.history.pushState(null, null, "/"); // Remove the streamURL param and log in history
			}
		}
		// Else if it is part of "https://" make sure the streamURL param is not there
		else if (streamURLElement.value.toString().length < 9) {
			document.title = `${documentTitle}`; // Update document title
			playerURL.searchParams.delete("streamURL"); // Delete streamURL param from the player URL
			window.history.pushState(null, null, "/"); // Remove the streamURL param and log in history
		}
	}
// Function for updating the player's state based on new user input. Always call after calling updateStreamFrame()
Function for updating the player's state based on new user input. Always call after calling updateStreamFrame()
Function for updating the player ' s state based on new user input . Always call after calling updateStreamFrame ()
function updatePlayer() {
		if (streamURLElement.value !== streamURL && streamURLElement.value.toString().length > 8) {
			gameFrameElement.src = ""; 
			gameFrameElement.src = defaultGameURL; 
			streamURL = streamURLElement.value;
			if (streamURL != "") {
				document.title = `${documentTitle} - ${streamURL}`; 
				playerURL.searchParams.set("streamURL", streamURLElement.value); 
				window.history.pushState(null, null, "?streamURL=" + encodeURIComponent(streamURL)); 
			}
			else {
				document.title = `${documentTitle}`; 
				playerURL.searchParams.delete("streamURL"); 
				window.history.pushState(null, null, "/"); 
			}
		}
		else if (streamURLElement.value.toString().length < 9) {
			document.title = `${documentTitle}`; 
			playerURL.searchParams.delete("streamURL"); 
			window.history.pushState(null, null, "/"); 
		}
	}
function updatePlayer ( ) { if ( streamURLElement . value !== streamURL && streamURLElement . value . toString ( ) . length > 8 ) { gameFrameElement . src = "" ; gameFrameElement . src = defaultGameURL ; streamURL = streamURLElement . value ; if ( streamURL != "" ) { document . title = ` ${ documentTitle } ${ streamURL } ` ; playerURL . searchParams . set ( "streamURL" , streamURLElement . value ) ; window . history . pushState ( null , null , "?streamURL=" + encodeURIComponent ( streamURL ) ) ; } else { document . title = ` ${ documentTitle } ` ; playerURL . searchParams . delete ( "streamURL" ) ; window . history . pushState ( null , null , "/" ) ; } } else if ( streamURLElement . value . toString ( ) . length < 9 ) { document . title = ` ${ documentTitle } ` ; playerURL . searchParams . delete ( "streamURL" ) ; window . history . pushState ( null , null , "/" ) ; } }
Function for updating the player's state based on new user input.
Function for updating the player ' s state based on new user input .
// If the stream URL input is different than the last saved one and is not just "https://" (which is 8 chars long) // Reload gameFrame frame // Clear src of gameFrame frame // Set src back to default game URL // Update the streamURL variable with the entered stream URL // If there is a stream URL entered // Update document title // Add stream URL as a param to the player URL // Add the streamURL to the window URL and log in history // Else it is empty // Update document title // Delete streamURL param from the player URL // Remove the streamURL param and log in history // Else if it is part of "https://" make sure the streamURL param is not there // Update document title // Delete streamURL param from the player URL // Remove the streamURL param and log in history