Set Stream Quality in iFrame

Eagle 3D Streaming

Set Stream Quality in iFrame

This guide explains how to let users change Pixel Streaming quality from a webpage that uses an E3DS iFrame embed.

Instead of using the default settings control bar, a custom HTML UI can be added outside the iFrame to send quality commands directly to the stream.

 

 

 

Follow the steps below:

Step 1. Add the Eagle 3D Streaming iFrame

First, embed the stream in your webpage.

<iframe id="iframe_1" src="https://connector.eagle3dstreaming.com/v5/demo/E3DSFeaturesTemplate/iframe" height="80%" width="100%" allowfullscreen title="Unreal Stream" ></iframe>

 

 

 

 

Step 2. Create a JavaScript function to send the quality command

Add a JavaScript function that sends a message to the iFrame using postMessage().

<script> function sendMessage(val) { let obj = { cmd: "setQualityPoint", value: val, }; document .getElementById("iframe_1") .contentWindow.postMessage(JSON.stringify(obj), "*"); } </script>

This function sends a command named setQualityPoint along with the selected quality value.

 

 

 

Step 3. Add custom quality buttons

Create buttons on your webpage and connect them to the sendMessage() function.

<button onclick="sendMessage(1)">Ultra</button> <button onclick="sendMessage(17)">High</button> <button onclick="sendMessage(34)">Medium</button> <button onclick="sendMessage(51)">Low</button>

When a user clicks one of these buttons, the selected quality value is sent to the Pixel Streaming iFrame.

 

 

 

Step 4. Use the correct quality values

Use the following values for each quality level:

Quality

Value

Quality

Value

Ultra

1

High

17

Medium

34

Low

51

Note:

  • Lower value → higher quality

  • Higher value → lower quality

 

 

 

Step 5. Test the integration

Open the webpage in your browser and click the quality buttons.
The stream quality inside the iFrame should update based on the selected value.

 

 

Full Example Code

Expand to view the complete example.

<html> <head> <title>Set Quality</title> <script> function sendMessage(val) { let obj = { cmd: "setQualityPoint", value: val, }; document .getElementById("iframe_1") .contentWindow.postMessage(JSON.stringify(obj), "*"); } </script> </head> <body> <div> <button onclick="sendMessage(1)">Ultra</button> <button onclick="sendMessage(17)">High</button> <button onclick="sendMessage(34)">Medium</button> <button onclick="sendMessage(51)">Low</button> </div> <div> <iframe id="iframe_1" src="https://connector.eagle3dstreaming.com/v5/demo/E3DSFeaturesTemplate/iframe" height="80%" width="100%" allowfullscreen title="Unreal Stream" ></iframe> </div> </body> </html>

 

 

 

 

Video Guide

 

 

 

 

 


Need help?

If you need any assistance, feel free to reach out through any of the following channels:

🛠️ Support Portal: Contact Our Support Team

💬 Discord Community (Faster Support): Join Our Discord Community

📧 Email Support: support@eagle3dstreaming.com

 

🆓 Get Started for free

 

 

Follow us on:

Facebook | GitHub | LinkedIn | YouTube

Eagle 3D Streaming