Class LivestreamService
java.lang.Object
vn.edu.uit.csbu.software_design.software_design_backend.livestream.LivestreamService
The `LivestreamService` class contains methods to check if a stream is live, check multiple streams,
validate stream keys, and retrieve current streaming information.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCurrentStreaming(int p, String serverIP) The function `getCurrentStreaming` retrieves live streaming information from a specified server and returns a list of account details for the live streams.booleanisStreamLive(String serverIP, String streamName) The function `isStreamLive` checks if a specified stream is live on a server by making a GET request to the server's status endpoint and parsing the XML response to find the stream name.isStreamsLive(String serverIP, List<String> streamNames) The function `isStreamsLive` checks if a list of stream names are live on a server using a provided server IP address.booleanisValidStreamKey(String streamKey) The function `isValidStreamKey` checks if a given stream key exists in the account repository.
-
Constructor Details
-
LivestreamService
public LivestreamService()
-
-
Method Details
-
isStreamLive
The function `isStreamLive` checks if a specified stream is live on a server by making a GET request to the server's status endpoint and parsing the XML response to find the stream name.- Parameters:
serverIP- The `serverIP` parameter is a String representing the IP address of the server where the streaming service is hosted. This IP address is used to construct the URL for checking the status of the stream.streamName- The `streamName` parameter in the `isStreamLive` method refers to the name of the stream you want to check if it is live on the specified server. This method sends a GET request to the server's status endpoint and parses the XML response to determine if the specified stream is currently live- Returns:
- This method is checking if a stream with a specific name is live on a server with a given IP address. If the stream is found in the XML response from the server, the method returns true, indicating that the stream is live. If there are any exceptions during the process or if the stream is not found, the method returns false.
-
isStreamsLive
The function `isStreamsLive` checks if a list of stream names are live on a server using a provided server IP address.- Parameters:
serverIP- The `serverIP` parameter is a String representing the IP address of the server where the streams are hosted.streamNames- The `streamNames` parameter is a list of strings that contains the names of streams that you want to check if they are live on the specified server.- Returns:
- A list of boolean values indicating whether each stream in the input list of stream names is live on the server with the specified IP address. Each boolean value corresponds to a stream name in the input list, where `true` indicates that the stream is live and `false` indicates that it is not live.
-
isValidStreamKey
The function `isValidStreamKey` checks if a given stream key exists in the account repository.- Parameters:
streamKey- Stream key is a unique identifier used to authenticate and authorize access to a streaming service or content. It is typically a long string of characters that is used to ensure that only authorized users can access the stream.- Returns:
- The method `isValidStreamKey` returns a boolean value indicating whether a stream key is valid or not based on whether it exists in the account repository.
-
getCurrentStreaming
The function `getCurrentStreaming` retrieves live streaming information from a specified server and returns a list of account details for the live streams.- Parameters:
p- The parameter `p` in the `getCurrentStreaming` method represents the page number for pagination. It is used to calculate the offset for fetching a subset of streaming data.serverIP- The `serverIP` parameter in the `getCurrentStreaming` method represents the IP address of the server from which you want to retrieve the streaming data. This IP address is used to construct the URL for the HTTP request to fetch the streaming status from the server.- Returns:
- A list of `accountSecureResponseDTO` objects representing the current streaming accounts based on the provided page number `p` and server IP address.
-