Embedded
Explores embedding various media formats into web pages, including HLS streaming, API/JSON data, and more
To create engaging and informative experiences.
Methods for Embedding Media:
iframe
tag: Creates a window displaying content from another website (e.g., YouTube videos).
iframe
<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
<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 thesrc
attribute specifying the image location.
img
<img src="image.jpg" alt="Image description">
- Videos: Utilize embed codes from platforms like YouTube or the
<video>
tag with playback controls.
video
<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
<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 thesrc
attribute pointing to the HLS manifest file (.m3u8).
video controls
<video width="800" height="600" controls>
<source src="playlist.m3u8" type="application/x-mpegURL">
Your browser doesn't support the video tag.
</video>
Embedding API/JSON Data:
- Use the
fetch()
API to retrieve JSON data from a URL.
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
<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.
Press to see my code🦋
gist.github.com/pripramot/a785d0cc1e7dac6e2..Exaple 1: hello-world.html
Example 1
The discovered code is"3c2650eb-e3d5-523a-8476-7629e5005e02"
view = play
The tower collapsed as a result
https://hlsp2p.com/play/3c2650eb-e3d5-523a-8476-7629e5005e02
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
Example 2 If I need something
player "jeawplay"
kakjeawplay.xyz The discovered code is "ugut2bi8xp"
Then I embed the command
embed
Results: Goodbye, online casino advertising.
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.
<img loading="lazy" src="https://cdn.hashnode.com/res/hashnode/image/upload/v1709072395077/7399d36f-1dc3-4332-acef-8fd6eab28ad5.png?auto=compress,format&format=webp?auto=compress,format&format=webp" alt="" class="image--center mx-auto">