[appium-device-farm-11] —Complete Details on -Enable/Disable’ — “live video Streaming” for the Session

Get a step-by-step walkthrough in the video below!
Appium Device Farm is a powerful plugin that enables parallel execution across real devices locally or remotely. One of its key features is Live Video Streaming, which allows you to watch the test session in real time — a valuable tool for debugging and monitoring.
In this article, we’ll cover how to enable or disable Live Video Streaming for a test session, both globally (via config) and per-session (via capabilities).
What is Live Video Streaming in Appium Device Farm?
Live video streaming displays the real-time screen output of the device during test execution. It helps:
- Monitor test execution visually
- Debug test failures interactively
- Showcase test runs in demos or reviews
Prerequisites
Before using the live streaming feature:
- You must have installed the Appium Device Farm plugin
- FFmpeg should be installed and available in your system
PATH
- Devices should be connected and discoverable by Appium
Youtube Video Link To Install “FFmpeg”:
Start Appium Server with Device-Farm plugin:
Command:
appium server -ka 800 --use-plugins=device-farm -pa /wd/hub --plugin-device-farm-platform=android
Example:

Enable/Disable Live Streaming Per Session (via Desired Capabilities)
You can also control streaming at a session level using the following capability:
Default Value for Live Streaming: Is Always True
//Default value for live video Streaming is true
To enable for a specific session:
//To Enable Live video streaming in Device Farm
cap.setCapability("df:liveVideo", true); //Live Video Streaming is enabled //Default value for live video Streaming is true
Example:

Click Maximize: To view Live Streaming in full scream

To disable for a specific session:
//To Disable live video streaming in Device Farm
cap.setCapability("df:liveVideo", false);
Java Example:
@BeforeClass
public void setup() throws MalformedURLException {
UiAutomator2Options cap=new UiAutomator2Options();
cap.setPlatformName("android");
cap.setAutomationName("uiautomator2");
cap.setDeviceName("Pixel9");
//To Enable & Disable the live video streaming in Device Farm
cap.setCapability("df:liveVideo", false); //Live Video Streaming is disabled
//cap.setCapability("df:liveVideo", true); //Live Video Streaming is enabled //Default value for live video Streaming is true
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
}
Enable Live Streaming Globally (via Plugin Config):
You can enable/disable live streaming globally in your Appium server config file.
JSON Config Example (appium-config.json)
{
"server": {
"port": 4723,
"plugin": {
"df:liveVideo": "true"
}
}
}
Where to View the Stream?
When enabled, the live video stream is accessible through the Device Farm Dashboard UI in the session window. You can monitor the test visually in real time.
Device-Farm Dashboard →Builds
Example:

Click Maximize: To view Live Streaming in full scream

Troubleshooting Tips
- Stream not showing up?
- Check FFmpeg path and installation.
- Ensure the device screen is active (not locked).
2. Stream is blank or lagging?
- Device resolution or encoding issues — try reducing resolution.
- Use wired connections for physical devices (not Wi-Fi only
3. Can’t find video stream URL?
- Make sure the Appium session is initialized and streaming is enabled at either global or session level.
“Complete Code: Optimized and Ready to Use”:
package com.appiumguide.devicefarm;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebElement;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import io.appium.java_client.AppiumBy;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.options.UiAutomator2Options;
import java.net.*;
import java.time.Duration;
/**
* Script Details - "appium-device-farm”- Complete Details on Enable/Disable “live video Streaming” for the Session Under “Appium Device Farm”
*
* appium-java-client version: 9.5.0
*
* @author 'Ramesh Kodumuru' for AppiumGuide [appiumguide@gmail.com]
*/
public class devicefarm_LiveVideoDemo {
private AndroidDriver driver;
WebElement dragelement,dropelement;
@BeforeClass
public void setup() throws MalformedURLException {
UiAutomator2Options cap=new UiAutomator2Options();
cap.setPlatformName("android");
cap.setAutomationName("uiautomator2");
cap.setDeviceName("Pixel9");
//To Enable & Disable the live video streaming in Device Farm
//cap.setCapability("df:liveVideo", false); //Live Video Streaming is disabled
cap.setCapability("df:liveVideo", true); //Live Video Streaming is enabled //Default value for live video Streaming is true
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
}
@Test
public void test1() throws InterruptedException {
driver.activateApp("com.wdiodemoapp");
driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().text(\"Drag\")")).click();
dragelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.ImageView\").instance(4)"));
dropelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.view.ViewGroup\").instance(10)"));
int eX=(int)(dropelement.getRect().getX());
int eY=(int)(dropelement.getRect().getY());
//Perform Drag gesture based on element id, endX & endY co-ordinates
System.out.println("Perform Drag gesture based on element id, endX & endY co-ordinates");
((JavascriptExecutor) driver).executeScript("mobile: dragGesture",ImmutableMap.of("elementId",((RemoteWebElement) dragelement).getId(),
"endX",eX,
"endY",eY));
Thread.sleep(3000);
dragelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.ImageView\").instance(7)"));
int sX=(int)(dragelement.getRect().getX());
int sY=(int)(dragelement.getRect().getY());
dropelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.view.ViewGroup\").instance(8)"));
int eX1=(int)(dropelement.getRect().getX());
int eY1=(int)(dropelement.getRect().getY());
//Perform Drag gesture based on element id, startX,startY,endX & endY co-ordinates
System.out.println("Perform Drag gesture based on element id, startX,startY,endX & endY co-ordinates");
((JavascriptExecutor) driver).executeScript("mobile: dragGesture",ImmutableMap.of(
"startX",sX,
"startY",sY,
"endX",eX1,
"endY",eY1));
Thread.sleep(3000);
////Perform Drag gesture based on element id,endX,endY co-ordinates and Speed
dragelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.ImageView\").instance(1)"));
dropelement=driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.view.ViewGroup\").instance(10)"));
int eX2=(int)(dropelement.getRect().getX());
int eY2=(int)(dropelement.getRect().getY());
int speedvalue=(int)(100*2.625);
System.out.println("Perform Drag gesture based on element id,endX,endY co-ordinates and Speed");
((JavascriptExecutor) driver).executeScript("mobile: dragGesture",ImmutableMap.of("elementId",((RemoteWebElement) dragelement).getId(),
"endX",eX2,
"endY",eY2,
"speed",speedvalue));
}
@AfterClass
public void teardown() {
if(driver!=null) {
driver.quit();
System.out.println("Test Execution Completed");
}
}
}
GitHub Link:
🎬 Explore More! Watch My Latest Videos on YouTube!
Visit My Official Blog:
No comments:
Post a Comment