# Embedded

To create engaging and informative experiences.

%[https://youtu.be/hZpKGGXDiPQ?si=fk946iSGqHqUpsc9] 

**Methods for Embedding Media:**

* `iframe` tag: Creates a window displaying content from another website (e.g., YouTube videos).
    

`iframe`

```xml
<iframe 
    width="560" height="315" 
    src="https://www.youtube.com/embed/dQw4w9WgXcQ" 
    title="YouTube video player"
    frameborder="0" 
    allow="accelerometer;autoplay; clipboard-write; encrypted-media;
     gyroscope; picture-in-picture" allowfullscreen>
</iframe>
```

* `object` tag: Offers more control over media, including source, dimensions, and alternative content.
    

`object`

```xml
<object data="video.mp4" type="video/mp4" width="320" height="240">
  <p>Your browser doesn't support the video tag.</p>
</object>
```

**Embedding Popular Media Types:**

* **Images:** Use the `<img>` tag with the `src` attribute specifying the image location.
    

`img`

```xml
<img src="image.jpg" alt="Image description">
```

* **Videos:** Utilize embed codes from platforms like YouTube or the `<video>` tag with playback controls.
    

`video`

```xml
<video width="800" height="600" controls>
  <source src="video.mp4" type="video/mp4">
  Your browser doesn't support the video tag.
</video>
```

* **Audio:** Employ embed codes from audio platforms or the `<audio>` tag with controls.
    

`audio`

```xml
<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
  Your browser doesn't support the audio tag.
</audio>
```

**Embedding HLS Streaming:**

* Use the `<video>` tag with the `src` attribute pointing to the HLS manifest file (.m3u8).
    

`video controls`

```xml
<video width="800" height="600" controls>
  <source src="playlist.m3u8" type="application/x-mpegURL">
  Your browser doesn't support the video tag.
</video>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1709021092778/69919fb9-5857-41e0-935c-89f625ac6043.webp align="center")

**Embedding API/JSON Data:**

* Use the `fetch()` API to retrieve JSON data from a URL.
    

**JavaScript**

```javascript
fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => {
    // Do something with the JSON data
  });
```

* Parse the JSON data and display it on the web page.
    

**HTML**

```json
<div id="data"></div>

<script>
const data = JSON.parse(document.getElementById('data').textContent);

// Display the JSON data on the web page
</script>
```

**Beyond the Basics:**

* The `<object>` tag allows embedding diverse formats like PDFs and interactive elements.
    

**Benefits of Media Integration:**

* Increased user engagement and interactivity.
    
* Cater to various learning styles.
    
* Display dynamic data from APIs.
    
* Deliver smooth live streaming experiences with HLS.
    

**Essential Considerations:**

* **Accessibility:** Provide alternative text descriptions for embedded media.
    
* **Responsive Design:** Ensure media adapts to different screen sizes.
    
* **Performance:** Optimize file sizes and consider lazy loading.
    

By effectively embedding multimedia, API/JSON data, and HLS streaming, you can create dynamic and engaging web experiences that captivate your audience, deliver information in a compelling way, and display live data from external sources.

[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg align="left")](https://github.com/pripramot/license/blob/master/LICENSE)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1709050197365/b6f49606-619d-44e2-b382-65684e7ddd68.png align="center")

<details>
<summary>Press to see my code🦋</summary>
https://gist.github.com/pripramot/a785d0cc1e7dac6e26cae4a759e3b712
</details>

# Exaple 1: **hello-world.html**

```graphql
Example 1
The discovered code is"3c2650eb-e3d5-523a-8476-7629e5005e02"
view = play
```

### The tower collapsed as a result

```http

https://hlsp2p.com/play/3c2650eb-e3d5-523a-8476-7629e5005e02
```

%[https://www.youtube.com/watch?v=Erwc9DepkFM&t=13s] 

---

# Example 2: Direct access and Embed

## You must choose a goal. that you want I can't choose for you.

### Launch Developer Tools with F12

```json
Example 2 If I need something
player "jeawplay"
kakjeawplay.xyz The discovered code is "ugut2bi8xp"
```

### Then I embed the command

```markdown
embed
```

### Results: Goodbye, online casino advertising.

```http
https://play.kakjeawplay.xyz/embed/ugut2bi8xp
```

---

# Example 3: พ่อเเม่ ครูบาอาจารย์.

## **Just a moment please.**

### Just a moment please.

# Example 4: Embedded CDN

## **img** cdn hashnode\*\*.\*\*

### Reduce the load on the server side.

```json
<img loading="lazy" src="https://cdn.hashnode.com/res/hashnode/image/upload/v1709072395077/7399d36f-1dc3-4332-acef-8fd6eab28ad5.png?auto=compress,format&amp;format=webp" alt="" class="image--center mx-auto">
```

### Results:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1709072395077/7399d36f-1dc3-4332-acef-8fd6eab28ad5.png align="center")

# Example 5: Direct access and Embed

## **Just a moment please.**

### Just a moment please.

# Example 6: Direct access and Embed

## **Just a moment please.**

### Just a moment please.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710424503672/74c12e37-68c0-4ccf-923a-be8ad97a81f6.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1710424431410/5a9e6a0a-ac83-43c6-b991-9cc79e8c60c9.png align="center")
