Imagine yourself as a game developer on Godot 4. 

Your goal is to add new functionality to an existing solution.

You need to add a slider, which, when clicked, changes the current track time.
You also need two labels, one of which is responsible for displaying the current time and the other for the end time of the track.

Current code:

extends Node

const MUSIC_DIR: String = "res://music"
const SUPPORTED_FORMATS: Array = [".mp3", ".ogg", ".wav"]
const FADE_DURATION: float = 0.75

#Audio Player and UI Elements
@onready var audio_player: AudioStreamPlayer = $AudioStreamPlayer
@onready var next_button: Button = $MarginContainer/HBoxContainer/NextButton
@onready var prev_button: Button = $MarginContainer/HBoxContainer/PrevButton
@onready var play_button: Button = $MarginContainer/HBoxContainer/PlayButton
@onready var current_track_label: Label = $MarginContainer/HBoxContainer/VBoxContainer/Panel/MarginContainer/TrackLabel
@onready var current_time_label: Label = $MarginContainer/HBoxContainer/VBoxContainer/Panel2/MarginContainer/VBoxContainer/HBoxContainer/CurrentTimeLabel
@onready var end_time_label: Label = $MarginContainer/HBoxContainer/VBoxContainer/Panel2/MarginContainer/VBoxContainer/HBoxContainer/EndTimeLabel
@onready var time_slider: HSlider = $MarginContainer/HBoxContainer/VBoxContainer/Panel2/MarginContainer/VBoxContainer/TimeSlider

@onready var pause_icon = preload("res://Pause.png")
@onready var play_icon = preload("res://Play.png")

#Music-related variables
var music_tracks: Array = []
var current_track_index: int = 0
var paused_playback_position: float = 0.0

func _ready() -> void:
	load_music_files()
	update_track_label()
	
func load_music_files():
	var dir = DirAccess.open(MUSIC_DIR)
	
	if not dir:
		push_error("Failed to open music directory: " + MUSIC_DIR)
		return
	
	dir.list_dir_begin() # skip navigational entries and hidden files
	var file_name = dir.get_next()
	
	while file_name:
		var extension = "." + file_name.get_extension().to_lower()
		if SUPPORTED_FORMATS.has(extension):
			var file_path = MUSIC_DIR + "/" + file_name
			music_tracks.append(file_path)
		file_name = dir.get_next()
	dir.list_dir_end()
	
	if music_tracks.is_empty():
		push_warning("No supported music files found in: " + MUSIC_DIR)
	else:
		print("Loaded ", music_tracks.size(), " music tracks.")

func fade(target_volume: float, start_volume: float) -> void:
	if FADE_DURATION <= 0:
		audio_player.volume_db = target_volume
		if target_volume == -80:
			audio_player.stop()
			paused_playback_position = 0
		else:
			audio_player.play()
		return
		
	var timer = 0.0
	audio_player.volume_db = start_volume
	if target_volume == 0:
		audio_player.play()
	while timer < FADE_DURATION:
		timer += get_process_delta_time()
		audio_player.volume_db = lerp(start_volume, target_volume, timer / FADE_DURATION)
		await get_tree().create_timer(0.01).timeout
		
	if target_volume == -80:
		audio_player.stop()
		paused_playback_position = 0

func fade_out() -> void:
	await fade(-80, 0)
	
func fade_in() -> void:
	await fade(0, -80)
	
func play_music() -> void:
	if music_tracks.is_empty():
		return
		
	var track_path = music_tracks[current_track_index]
	var stream = ResourceLoader.load(track_path) as AudioStream
	
	if stream:
		audio_player.stream = stream
		if paused_playback_position > 0:
			audio_player.play(paused_playback_position)
		else:
			audio_player.play()
			fade_in()
			
func pause_music() -> void:
	if audio_player.playing:
		paused_playback_position = audio_player.get_playback_position()
		audio_player.stop()
		
func stop_music() -> void:
	if audio_player.playing:
		paused_playback_position = 0
		fade_out()
	
func change_track(offset: int) -> void:
	if music_tracks.is_empty():
		return
	
	await fade_out()
	paused_playback_position = 0
	current_track_index = (current_track_index + offset + music_tracks.size()) % music_tracks.size()
	play_music()
	update_track_label()
	
func next_track():
	change_track(1)
	play_button.icon = pause_icon
	
func prev_track():
	if audio_player.get_playback_position() > 10:
		audio_player.seek(0)
	else:
		change_track(-1)

func update_track_label() -> void:
	if music_tracks.is_empty():
		current_track_label.text = "No music found"
	else:
		var track_name = music_tracks[current_track_index].get_file().get_basename()
		current_track_label.text = track_name
		
func _on_play_button_pressed() -> void:
	if audio_player.playing:
		pause_music()
		play_button.icon = play_icon
	else:
		play_music()
		play_button.icon = pause_icon
	
func _on_next_button_pressed() -> void:
	next_track()

func _on_prev_button_pressed() -> void:
	prev_track()