mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 21:30:58 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/HTML/EventLoop/Task.h>
 | |
| #include <LibWeb/HTML/HTMLElement.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| class HTMLMediaElement : public HTMLElement {
 | |
|     WEB_PLATFORM_OBJECT(HTMLMediaElement, HTMLElement);
 | |
| 
 | |
| public:
 | |
|     virtual ~HTMLMediaElement() override;
 | |
| 
 | |
|     void queue_a_media_element_task(JS::SafeFunction<void()> steps);
 | |
| 
 | |
|     enum class NetworkState : u16 {
 | |
|         Empty,
 | |
|         Idle,
 | |
|         Loading,
 | |
|         NoSource,
 | |
|     };
 | |
|     NetworkState network_state() const { return m_network_state; }
 | |
| 
 | |
|     Bindings::CanPlayTypeResult can_play_type(DeprecatedString const& type) const;
 | |
| 
 | |
|     void load() const;
 | |
|     void pause() const;
 | |
| 
 | |
| protected:
 | |
|     HTMLMediaElement(DOM::Document&, DOM::QualifiedName);
 | |
| 
 | |
|     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
 | |
| 
 | |
| private:
 | |
|     Task::Source media_element_event_task_source() const { return m_media_element_event_task_source.source; }
 | |
| 
 | |
|     // https://html.spec.whatwg.org/multipage/media.html#media-element-event-task-source
 | |
|     UniqueTaskSource m_media_element_event_task_source {};
 | |
| 
 | |
|     // https://html.spec.whatwg.org/multipage/media.html#dom-media-networkstate
 | |
|     NetworkState m_network_state { NetworkState::Empty };
 | |
| };
 | |
| 
 | |
| }
 | 
