DekTec logo
StreamXpress Remote Control: Python Script Examples  

StreamXpress Remote Control: Python Script Examples

Explore practical Python script examples for remotely controlling the StreamXpress player application.

 

Setting Up Python

Step-by-step instructions for setting up Python on a Windows system are available here.

Basic Example: Playing Out a File

In this example, you will learn how to establish a connection to StreamXpress, select a file for playback, start the playback, and wait until it stops. Note that the DekTec device used for playback with StreamXpress must have a remote control (RC) license.

Here's the sample code:

# Import the Python package for StreamXpress remote control.
from SpRcImport import *	

# Create a remote-control client.
sprc = SPRC_client()

# Open a session.
sprc.open_session(ip_host='http://localhost', ip_port=5000)

# Select DTA-2174B ASI-output port #1 for playout.
# Replace the serial number with the S/N of your card.
sprc.select_port(2174200001, 1, 0)

# Select a file for playout.
sprc.open_file('C:\\Streams\\MyFile.ts')

# Start playout.
sprc.set_playout_state(SPRC.STATE_PLAY)

# Wait until playout stops.
sprc.wait_for_condition(SPRC.COND_STOPPED, -1)

# Clean up.
sprc.close_session()

Instructions:

  1. Launch StreamXpress from the Command Prompt with the -rc option, followed by the IP port number used to connect:
    StreamXpress.exe -rc 5000
  2. Run your Python client application:
    python YourClientApp.py

Note: The package creates a temporary WSDL file. Ensure the application has write permissions for the SpRcImport folder.

More Examples

Explore the examples below to gain a deeper understanding of operating the StreamXpress through its remote control interface.

Example Description
AsiTxDemo This Python script selects the first ASI port available for playout and plays out the file, while printing progress.
MimoTxDemo This is an advanced example that creates two remote control instances to control two StreamXpress instances. By using the SFN mode, playout begins precisely at predefined GPS times. The outcome is two synchronized RF signals, GPS-synchronized, which can be used for various applications such as MIMO testing.
SpRcDemo This example provides code snippets that demonstrates the usage of the SPRC remote-control functions.