From 20a08fe6fbf9ec662c4481a15bec56ad027247cb Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 6 Feb 2023 16:25:14 +0530 Subject: [PATCH 01/36] Create antmedia-samples.py --- Selenium/antmedia-samples.py | 104 +++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Selenium/antmedia-samples.py diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py new file mode 100644 index 00000000..5745f867 --- /dev/null +++ b/Selenium/antmedia-samples.py @@ -0,0 +1,104 @@ +# Used to import the webdriver from selenium +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.chrome.options import Options +import time + +options = Options() +options.add_argument('--headless') +options.add_argument("--use-fake-ui-for-media-stream") +options.add_argument("--use-fake-device-for-media-stream") +driver = webdriver.Chrome(options=options) +driver.maximize_window() + +driver.get("https://antmedia.io/webrtc-samples/") + +#Testing Virtual Background Sample Page +for i in range(2): + try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") + driver.switch_to.window(driver.window_handles[1]) + time.sleep(20) + driver.switch_to.frame(0) + time.sleep(3) + driver.find_element(By.XPATH,"/html/body/div/div/div[4]/div[3]/img").click() + time.sleep(5) + driver.find_element(By.XPATH,"/html/body/div/div/div[7]/button[1]").click() + time.sleep(15) + driver.find_element(By.XPATH,"/html/body/div/div/div[7]/button[2]").click() + time.sleep(3) + print("WebRTC virtual background is successful") + break + + except: + if i==1: + print("An error occurred in Vitual background test case.") + continue + +#Testing WebRTC and HLS Comparison Live Demo Page +try: + driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") + driver.switch_to.window(driver.window_handles[2]) + time.sleep(15) + driver.find_element(By.XPATH,"/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() + time.sleep(15) + driver.find_element(By.XPATH,"/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() + time.sleep(3) + print("Live demo is successful") + +except: + print("An error occurred in live demo test case.") + +#Testing WebRTC publlish Sample Page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/', '_blank');") + driver.switch_to.window(driver.window_handles[3]) + time.sleep(15) + driver.switch_to.frame(0) + time.sleep(3) + driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() + time.sleep(15) + driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[2]").click() + time.sleep(3) + print("WebRTC publish is successful") + +except: + print("An error occurred in WebRTC publish test case.") + +#Testing WebRTC audio publish sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/', '_blank');") + driver.switch_to.window(driver.window_handles[4]) + time.sleep(15) + driver.switch_to.frame(0) + time.sleep(3) + driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() + time.sleep(15) + driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[2]").click() + time.sleep(3) + print("WebRTC audio publish is successful") + +except: + print("An error occurred in audio publish test case.") + +#Testing WebRTC data channel sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") + driver.switch_to.window(driver.window_handles[5]) + time.sleep(15) + driver.switch_to.frame(0) + time.sleep(3) + driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() + time.sleep(3) + text = driver.find_element(By.ID,'dataTextbox') + text.send_keys("Hello, how are you ?") + driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div/div[2]/button").click() + time.sleep(15) + driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[2]").click() + time.sleep(3) + print("WebRTC data channel is successful") + +except: + print("An error occurred in data channel test case.") + +driver.quit() From 7f73283eb5e893589938c4b7717b9e0112de14d8 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 20 Feb 2023 12:52:34 +0530 Subject: [PATCH 02/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 38 +++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 5745f867..f4dd43a3 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -3,6 +3,25 @@ from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options import time +import json +import requests +import os + +#Function to send notification to Slack +def send_slack_message(webhook_url, message, icon_emoji=":x:"): + payload = { + "text": message, + "icon_emoji": icon_emoji + } + response = requests.post(webhook_url, data={"payload": json.dumps(payload)}) + + if response.status_code != 200: + print("Error sending Slack message: ", response.text) + else: + print("Slack message sent successfully!") + +webhook_url = os.environ['WEBHOOK_URL'] +icon_emoji = ":x:" options = Options() options.add_argument('--headless') @@ -32,7 +51,8 @@ except: if i==1: - print("An error occurred in Vitual background test case.") + message = "Virtual background test is failed and this is for testing-> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" + send_slack_message(webhook_url, message, icon_emoji) continue #Testing WebRTC and HLS Comparison Live Demo Page @@ -47,7 +67,8 @@ print("Live demo is successful") except: - print("An error occurred in live demo test case.") + message = "Livedemo test is failed, check -> https://antmedia.io/live-demo/" + send_slack_message(webhook_url, message, icon_emoji) #Testing WebRTC publlish Sample Page try: @@ -63,7 +84,8 @@ print("WebRTC publish is successful") except: - print("An error occurred in WebRTC publish test case.") + message = "WebRTC publish test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/" + send_slack_message(webhook_url, message, icon_emoji) #Testing WebRTC audio publish sample page try: @@ -79,7 +101,8 @@ print("WebRTC audio publish is successful") except: - print("An error occurred in audio publish test case.") + message = "WebRTC audio publish test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/" + send_slack_message(webhook_url, message, icon_emoji) #Testing WebRTC data channel sample page try: @@ -89,16 +112,17 @@ driver.switch_to.frame(0) time.sleep(3) driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() - time.sleep(3) + time.sleep(5) text = driver.find_element(By.ID,'dataTextbox') text.send_keys("Hello, how are you ?") driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div/div[2]/button").click() - time.sleep(15) + time.sleep(20) driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[2]").click() time.sleep(3) print("WebRTC data channel is successful") except: - print("An error occurred in data channel test case.") + message = "WebRTC data channel test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-data-channel-only/" + send_slack_message(webhook_url, message, icon_emoji) driver.quit() From fbe276c04955646d1cfc297c3dbfc838f4890ff5 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Sun, 5 Mar 2023 21:07:24 +0530 Subject: [PATCH 03/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 129 ++++++++++++++++++++++++++++++----- 1 file changed, 113 insertions(+), 16 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index f4dd43a3..778d8d8f 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -5,7 +5,7 @@ import time import json import requests -import os +import subprocess #Function to send notification to Slack def send_slack_message(webhook_url, message, icon_emoji=":x:"): @@ -20,7 +20,22 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): else: print("Slack message sent successfully!") -webhook_url = os.environ['WEBHOOK_URL'] +#Function to define and run FFMPEG +def publish_with_ffmpeg(output, rtmp_url): + +# Start FFmpeg process + ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] + ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output , rtmp_url] + + ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = ffmpeg_process.communicate() + +#Function to close the old tab and open new one +def switch_to_first_tab(driver): + driver.close() + driver.switch_to.window(driver.window_handles[0]) + +webhook_url = "https://hooks.slack.com/services/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" icon_emoji = ":x:" options = Options() @@ -51,14 +66,16 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): except: if i==1: - message = "Virtual background test is failed and this is for testing-> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" + message = "Virtual background test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" send_slack_message(webhook_url, message, icon_emoji) continue +switch_to_first_tab(driver) + #Testing WebRTC and HLS Comparison Live Demo Page try: driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") - driver.switch_to.window(driver.window_handles[2]) + driver.switch_to.window(driver.window_handles[1]) time.sleep(15) driver.find_element(By.XPATH,"/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) @@ -70,44 +87,124 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): message = "Livedemo test is failed, check -> https://antmedia.io/live-demo/" send_slack_message(webhook_url, message, icon_emoji) -#Testing WebRTC publlish Sample Page +switch_to_first_tab(driver) + +#Testing WebRTC to WebRTC Sample Page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/', '_blank');") - driver.switch_to.window(driver.window_handles[3]) + driver.switch_to.window(driver.window_handles[1]) time.sleep(15) driver.switch_to.frame(0) time.sleep(3) driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() - time.sleep(15) + time.sleep(10) + driver.find_element(By.XPATH,"/html/body/div/div/div[7]/div[1]/a").click() + time.sleep(5) driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[2]").click() time.sleep(3) - print("WebRTC publish is successful") + print("WebRTC to WebRTC is successful") except: - message = "WebRTC publish test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/" + message = "WebRTC to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/" send_slack_message(webhook_url, message, icon_emoji) -#Testing WebRTC audio publish sample page +driver.close() +driver.switch_to.window(driver.window_handles[1]) +switch_to_first_tab(driver) + +#Testing WebRTC to HLS Sample Page try: - driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/', '_blank');") - driver.switch_to.window(driver.window_handles[4]) + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-hls-play/', '_blank');") + driver.switch_to.window(driver.window_handles[1]) time.sleep(15) driver.switch_to.frame(0) time.sleep(3) + driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() + time.sleep(10) + driver.find_element(By.XPATH,"/html/body/div/div/div[7]/div[1]/a").click() + time.sleep(5) + driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[2]").click() + time.sleep(5) + print("WebRTC to HLS is successful") + +except: + message = "WebRTC to HLS test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/" + send_slack_message(webhook_url, message, icon_emoji) + +driver.close() +driver.switch_to.window(driver.window_handles[1]) +switch_to_first_tab(driver) + +#Testing WebRTC audio publish sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/', '_blank');") + driver.switch_to.window(driver.window_handles[1]) + time.sleep(5) + driver.switch_to.frame(0) + time.sleep(2) driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() - time.sleep(15) - driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[2]").click() time.sleep(3) + driver.find_element(By.XPATH,"/html/body/div/div/div[5]/div[1]/a").click() + driver.switch_to.window(driver.window_handles[2]) + time.sleep(2) + driver.switch_to.frame(0) + time.sleep(2) + driver.find_element(By.XPATH,"/html/body/div/div/div[4]/button[1]").click() + time.sleep(10) + driver.find_element(By.XPATH,"/html/body/div/div/div[4]/button[2]").click() + time.sleep(2) print("WebRTC audio publish is successful") except: - message = "WebRTC audio publish test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/" + message = "WebRTC audio publish and play test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/" send_slack_message(webhook_url, message, icon_emoji) +driver.close() +driver.switch_to.window(driver.window_handles[1]) +switch_to_first_tab(driver) + +#Testing RTMP to WebRTC sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-webrtc-play/', '_blank');") + driver.switch_to.window(driver.window_handles[1]) + time.sleep(15) + driver.switch_to.frame(0) + time.sleep(5) + rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + rtmp_url = rtmp_element.text + output= 'flv' + publish_with_ffmpeg(output, rtmp_url) + print("RTMP to WebRTC is successful") + +except: + message = "RTMP to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-wertc-play/" + send_slack_message(webhook_url, message, icon_emoji) + +switch_to_first_tab(driver) + +#Testing RTMP to HLS sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-hls-play/', '_blank');") + driver.switch_to.window(driver.window_handles[1]) + time.sleep(15) + driver.switch_to.frame(0) + time.sleep(5) + rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + rtmp_url = rtmp_element.text + output= 'flv' + publish_with_ffmpeg(output, rtmp_url) + print("RTMP to HLS is successful") + +except: + message = "RTMP to HLS test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-wertc-play/" + send_slack_message(webhook_url, message, icon_emoji) + +switch_to_first_tab(driver) + #Testing WebRTC data channel sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") - driver.switch_to.window(driver.window_handles[5]) + driver.switch_to.window(driver.window_handles[1]) time.sleep(15) driver.switch_to.frame(0) time.sleep(3) From c48898fb20d24aed11761564231664104cb3001c Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Sun, 5 Mar 2023 21:59:25 +0530 Subject: [PATCH 04/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 778d8d8f..b9d978aa 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -24,11 +24,16 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): def publish_with_ffmpeg(output, rtmp_url): # Start FFmpeg process - ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] - ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output , rtmp_url] + valid_outputs = ['flv', 'mpegts'] # list of valid output formats - ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = ffmpeg_process.communicate() +if output in valid_outputs: + ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] + ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output, rtmp_url] + + ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = ffmpeg_process.communicate() +else: + print("Invalid output format specified") #Function to close the old tab and open new one def switch_to_first_tab(driver): From 2a6140e7b4b3473eacc9b5d604fbfee217be68db Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Sun, 5 Mar 2023 22:12:54 +0530 Subject: [PATCH 05/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index b9d978aa..aec6bf10 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -24,16 +24,11 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): def publish_with_ffmpeg(output, rtmp_url): # Start FFmpeg process - valid_outputs = ['flv', 'mpegts'] # list of valid output formats - -if output in valid_outputs: ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output, rtmp_url] - ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ffmpeg_process = subprocess.run(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() -else: - print("Invalid output format specified") #Function to close the old tab and open new one def switch_to_first_tab(driver): From 2ab9078e4930108723759de08bdd7982a8acbe65 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Sat, 18 Mar 2023 13:11:55 +0530 Subject: [PATCH 06/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 158 +++++++++++++++++++++++------------ 1 file changed, 106 insertions(+), 52 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index aec6bf10..76152fe5 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -1,11 +1,14 @@ # Used to import the webdriver from selenium -from selenium import webdriver -from selenium.webdriver.common.by import By -from selenium.webdriver.chrome.options import Options +import os import time import json import requests import subprocess +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC #Function to send notification to Slack def send_slack_message(webhook_url, message, icon_emoji=":x:"): @@ -20,22 +23,48 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): else: print("Slack message sent successfully!") -#Function to define and run FFMPEG -def publish_with_ffmpeg(output, rtmp_url): - -# Start FFmpeg process - ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] - ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output, rtmp_url] - - ffmpeg_process = subprocess.run(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = ffmpeg_process.communicate() - -#Function to close the old tab and open new one +#Function to start FFMPEG process +def publish_with_ffmpeg(output, url, protocol='rtmp'): + if protocol == 'rtmp': + # Start FFmpeg process for RTMP streaming + ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] + ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output, url] + ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = ffmpeg_process.communicate() + + elif protocol == 'srt': + # Start FFmpeg process for SRT streaming + ffmpeg_command = ['ffmpeg', '-f', 'lavfi', '-re', '-i', 'smptebars=duration=60:size=1280x720:rate=30', '-f', 'lavfi', '-re', '-i', 'sine=frequency=1000:duration=60:sample_rate=44100', '-pix_fmt', 'yuv420p', '-c:v', 'libx264', '-b:v', '1000k', '-g', '30', '-keyint_min', '120', '-profile:v', 'baseline', '-preset', 'veryfast', '-t', '30', '-f', output, 'udp://127.0.0.1:5000?pkt_size=1316'] + ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + srt_command = ['srt-live-transmit', 'udp://127.0.0.1:5000', '-t', '30', url] + srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = ffmpeg_process.communicate() + srt_stdout, srt_stderr = srt_process.communicate() + srt_exit_code = srt_process.returncode + return srt_exit_code + +#Function to close the previous tabs before starting the new test def switch_to_first_tab(driver): - driver.close() - driver.switch_to.window(driver.window_handles[0]) - -webhook_url = "https://hooks.slack.com/services/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" + if len(driver.window_handles) > 1: + driver.close() + driver.switch_to.window(driver.window_handles[0]) + +#Function to remove advertisement from sample pages +def remove_ad(driver): + wait = WebDriverWait(driver, 10) + button = wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div/button"))) + button.click() + +#Function to switch to new window and close the advertisement block +def switch_window_and_frame(driver): + driver.switch_to.window(driver.window_handles[1]) + time.sleep(2) + remove_ad(driver) + time.sleep(15) + driver.switch_to.frame(0) + time.sleep(3) + +webhook_url = os.environ['WEBHOOK_URL'] icon_emoji = ":x:" options = Options() @@ -46,12 +75,15 @@ def switch_to_first_tab(driver): driver.maximize_window() driver.get("https://antmedia.io/webrtc-samples/") +remove_ad(driver) #Testing Virtual Background Sample Page for i in range(2): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") driver.switch_to.window(driver.window_handles[1]) + time.sleep(2) + remove_ad(driver) time.sleep(20) driver.switch_to.frame(0) time.sleep(3) @@ -66,7 +98,7 @@ def switch_to_first_tab(driver): except: if i==1: - message = "Virtual background test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" + message = "Virtual background test is failed and this is for testing-> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" send_slack_message(webhook_url, message, icon_emoji) continue @@ -76,6 +108,8 @@ def switch_to_first_tab(driver): try: driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) + time.sleep(2) + remove_ad(driver) time.sleep(15) driver.find_element(By.XPATH,"/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) @@ -92,10 +126,7 @@ def switch_to_first_tab(driver): #Testing WebRTC to WebRTC Sample Page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/', '_blank');") - driver.switch_to.window(driver.window_handles[1]) - time.sleep(15) - driver.switch_to.frame(0) - time.sleep(3) + switch_window_and_frame(driver) driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() time.sleep(10) driver.find_element(By.XPATH,"/html/body/div/div/div[7]/div[1]/a").click() @@ -115,10 +146,7 @@ def switch_to_first_tab(driver): #Testing WebRTC to HLS Sample Page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-hls-play/', '_blank');") - driver.switch_to.window(driver.window_handles[1]) - time.sleep(15) - driver.switch_to.frame(0) - time.sleep(3) + switch_window_and_frame(driver) driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() time.sleep(10) driver.find_element(By.XPATH,"/html/body/div/div/div[7]/div[1]/a").click() @@ -128,7 +156,7 @@ def switch_to_first_tab(driver): print("WebRTC to HLS is successful") except: - message = "WebRTC to HLS test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/" + message = "WebRTC to HLS test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-publish-hls-play/" send_slack_message(webhook_url, message, icon_emoji) driver.close() @@ -138,10 +166,7 @@ def switch_to_first_tab(driver): #Testing WebRTC audio publish sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/', '_blank');") - driver.switch_to.window(driver.window_handles[1]) - time.sleep(5) - driver.switch_to.frame(0) - time.sleep(2) + switch_window_and_frame(driver) driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() time.sleep(3) driver.find_element(By.XPATH,"/html/body/div/div/div[5]/div[1]/a").click() @@ -153,10 +178,10 @@ def switch_to_first_tab(driver): time.sleep(10) driver.find_element(By.XPATH,"/html/body/div/div/div[4]/button[2]").click() time.sleep(2) - print("WebRTC audio publish is successful") + print("WebRTC audio publish and play is successful") except: - message = "WebRTC audio publish and play test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/" + message = "WebRTC audio publish test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/" send_slack_message(webhook_url, message, icon_emoji) driver.close() @@ -166,14 +191,11 @@ def switch_to_first_tab(driver): #Testing RTMP to WebRTC sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-webrtc-play/', '_blank');") - driver.switch_to.window(driver.window_handles[1]) - time.sleep(15) - driver.switch_to.frame(0) - time.sleep(5) + switch_window_and_frame(driver) rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") - rtmp_url = rtmp_element.text + url = rtmp_element.text output= 'flv' - publish_with_ffmpeg(output, rtmp_url) + publish_with_ffmpeg(output, url, protocol='rtmp') print("RTMP to WebRTC is successful") except: @@ -185,18 +207,53 @@ def switch_to_first_tab(driver): #Testing RTMP to HLS sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-hls-play/', '_blank');") - driver.switch_to.window(driver.window_handles[1]) - time.sleep(15) - driver.switch_to.frame(0) - time.sleep(5) + switch_window_and_frame(driver) rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") - rtmp_url = rtmp_element.text + url = rtmp_element.text output= 'flv' - publish_with_ffmpeg(output, rtmp_url) + publish_with_ffmpeg(output, url, protocol='rtmp') print("RTMP to HLS is successful") except: - message = "RTMP to HLS test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-wertc-play/" + message = "RTMP to HLS test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-hls-play/" + send_slack_message(webhook_url, message, icon_emoji) + +switch_to_first_tab(driver) + +#Testing SRT to WebRTC sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-webrtc-play/', '_blank');") + switch_window_and_frame(driver) + srt_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + url = srt_element.text + output= 'mpegts' + srt_exit_code = publish_with_ffmpeg(output, url, protocol='srt') + if srt_exit_code == 0: + print("SRT to WebRTC is successful") + else: + raise Exception("SRT to WebRTC test is failed") + +except: + message = "SRT to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/srt-publish-webrtc-play/" + send_slack_message(webhook_url, message, icon_emoji) + +switch_to_first_tab(driver) + +#Testing SRT to HLS sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-hls-play/', '_blank');") + switch_window_and_frame(driver) + srt_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + url = srt_element.text + output= 'mpegts' + srt_exit_code = publish_with_ffmpeg(output, url, protocol='srt') + if srt_exit_code == 0: + print("SRT to HLS is successful") + else: + raise Exception("SRT to HLS test is failed") + +except: + message = "SRT to HLS test is failed, check -> https://antmedia.io/webrtc-samples/srt-publish-hls-play/" send_slack_message(webhook_url, message, icon_emoji) switch_to_first_tab(driver) @@ -204,10 +261,7 @@ def switch_to_first_tab(driver): #Testing WebRTC data channel sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") - driver.switch_to.window(driver.window_handles[1]) - time.sleep(15) - driver.switch_to.frame(0) - time.sleep(3) + switch_window_and_frame(driver) driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() time.sleep(5) text = driver.find_element(By.ID,'dataTextbox') @@ -221,5 +275,5 @@ def switch_to_first_tab(driver): except: message = "WebRTC data channel test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-data-channel-only/" send_slack_message(webhook_url, message, icon_emoji) - + driver.quit() From be91c82a31f3cafaaf36fda1b3c150728c455b5a Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Sat, 18 Mar 2023 19:24:46 +0530 Subject: [PATCH 07/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 76152fe5..6339ff1c 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -2,6 +2,7 @@ import os import time import json +import shlex import requests import subprocess from selenium import webdriver @@ -27,15 +28,16 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): def publish_with_ffmpeg(output, url, protocol='rtmp'): if protocol == 'rtmp': # Start FFmpeg process for RTMP streaming - ffmpeg_command = ['ffmpeg', '-re', '-f', 'lavfi', '-i', 'smptebars', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-profile:v', 'baseline'] - ffmpeg_command += ['-c:a', 'aac', '-b:a', '128k', '-t', '30', '-f', output, url] - ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ffmpeg_command = 'ffmpeg -re -f lavfi -i smptebars -c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline -c:a aac -b:a 128k -t 30 -f ' + output + ' ' + url + ffmpeg_args = shlex.split(ffmpeg_command) + ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() elif protocol == 'srt': # Start FFmpeg process for SRT streaming - ffmpeg_command = ['ffmpeg', '-f', 'lavfi', '-re', '-i', 'smptebars=duration=60:size=1280x720:rate=30', '-f', 'lavfi', '-re', '-i', 'sine=frequency=1000:duration=60:sample_rate=44100', '-pix_fmt', 'yuv420p', '-c:v', 'libx264', '-b:v', '1000k', '-g', '30', '-keyint_min', '120', '-profile:v', 'baseline', '-preset', 'veryfast', '-t', '30', '-f', output, 'udp://127.0.0.1:5000?pkt_size=1316'] - ffmpeg_process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ffmpeg_command = 'ffmpeg -f lavfi -re -i smptebars=duration=60:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -t 30 -f ' + output + ' udp://127.0.0.1:5000?pkt_size=1316' + ffmpeg_args = shlex.split(ffmpeg_command) + ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) srt_command = ['srt-live-transmit', 'udp://127.0.0.1:5000', '-t', '30', url] srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() From 5a093a3d1d76e276cd0c6313344d45a2faaa1372 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Sun, 19 Mar 2023 00:18:33 +0530 Subject: [PATCH 08/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 6339ff1c..b8dd8a2d 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -5,6 +5,7 @@ import shlex import requests import subprocess +import urllib.parse from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options @@ -25,20 +26,22 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): print("Slack message sent successfully!") #Function to start FFMPEG process -def publish_with_ffmpeg(output, url, protocol='rtmp'): +def publish_with_ffmpeg(url, protocol='rtmp'): if protocol == 'rtmp': # Start FFmpeg process for RTMP streaming - ffmpeg_command = 'ffmpeg -re -f lavfi -i smptebars -c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline -c:a aac -b:a 128k -t 30 -f ' + output + ' ' + url + quoted_url = shlex.quote(url) + ffmpeg_command = 'ffmpeg -re -f lavfi -i smptebars -c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline -c:a aac -b:a 128k -t 30 -f flv' + ' ' + quoted_url ffmpeg_args = shlex.split(ffmpeg_command) ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() elif protocol == 'srt': # Start FFmpeg process for SRT streaming - ffmpeg_command = 'ffmpeg -f lavfi -re -i smptebars=duration=60:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -t 30 -f ' + output + ' udp://127.0.0.1:5000?pkt_size=1316' + quoted_url = urllib.parse.quote(url, safe=':/?=') + ffmpeg_command = 'ffmpeg -f lavfi -re -i smptebars=duration=60:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -t 30 -f mpegts udp://127.0.0.1:5000?pkt_size=1316' ffmpeg_args = shlex.split(ffmpeg_command) ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - srt_command = ['srt-live-transmit', 'udp://127.0.0.1:5000', '-t', '30', url] + srt_command = ['srt-live-transmit', 'udp://127.0.0.1:5000', '-t', '30', quoted_url] srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() srt_stdout, srt_stderr = srt_process.communicate() @@ -196,8 +199,7 @@ def switch_window_and_frame(driver): switch_window_and_frame(driver) rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") url = rtmp_element.text - output= 'flv' - publish_with_ffmpeg(output, url, protocol='rtmp') + publish_with_ffmpeg(url, protocol='rtmp') print("RTMP to WebRTC is successful") except: @@ -212,8 +214,7 @@ def switch_window_and_frame(driver): switch_window_and_frame(driver) rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") url = rtmp_element.text - output= 'flv' - publish_with_ffmpeg(output, url, protocol='rtmp') + publish_with_ffmpeg(url, protocol='rtmp') print("RTMP to HLS is successful") except: @@ -228,8 +229,7 @@ def switch_window_and_frame(driver): switch_window_and_frame(driver) srt_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") url = srt_element.text - output= 'mpegts' - srt_exit_code = publish_with_ffmpeg(output, url, protocol='srt') + srt_exit_code = publish_with_ffmpeg(url, protocol='srt') if srt_exit_code == 0: print("SRT to WebRTC is successful") else: @@ -247,8 +247,7 @@ def switch_window_and_frame(driver): switch_window_and_frame(driver) srt_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") url = srt_element.text - output= 'mpegts' - srt_exit_code = publish_with_ffmpeg(output, url, protocol='srt') + srt_exit_code = publish_with_ffmpeg(url, protocol='srt') if srt_exit_code == 0: print("SRT to HLS is successful") else: From 162a912eca26b34f515e1951115f6ddf8bce6800 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Tue, 21 Mar 2023 12:53:43 +0530 Subject: [PATCH 09/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index b8dd8a2d..dbc19905 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -32,7 +32,7 @@ def publish_with_ffmpeg(url, protocol='rtmp'): quoted_url = shlex.quote(url) ffmpeg_command = 'ffmpeg -re -f lavfi -i smptebars -c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline -c:a aac -b:a 128k -t 30 -f flv' + ' ' + quoted_url ffmpeg_args = shlex.split(ffmpeg_command) - ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) stdout, stderr = ffmpeg_process.communicate() elif protocol == 'srt': @@ -40,9 +40,9 @@ def publish_with_ffmpeg(url, protocol='rtmp'): quoted_url = urllib.parse.quote(url, safe=':/?=') ffmpeg_command = 'ffmpeg -f lavfi -re -i smptebars=duration=60:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -t 30 -f mpegts udp://127.0.0.1:5000?pkt_size=1316' ffmpeg_args = shlex.split(ffmpeg_command) - ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) srt_command = ['srt-live-transmit', 'udp://127.0.0.1:5000', '-t', '30', quoted_url] - srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) stdout, stderr = ffmpeg_process.communicate() srt_stdout, srt_stderr = srt_process.communicate() srt_exit_code = srt_process.returncode @@ -103,7 +103,7 @@ def switch_window_and_frame(driver): except: if i==1: - message = "Virtual background test is failed and this is for testing-> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" + message = "Virtual background test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-virtual-background/" send_slack_message(webhook_url, message, icon_emoji) continue From 466d67583760193e735a589020d976dbe0b30afa Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Tue, 21 Mar 2023 13:35:14 +0530 Subject: [PATCH 10/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index dbc19905..e7d199ab 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -32,7 +32,7 @@ def publish_with_ffmpeg(url, protocol='rtmp'): quoted_url = shlex.quote(url) ffmpeg_command = 'ffmpeg -re -f lavfi -i smptebars -c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline -c:a aac -b:a 128k -t 30 -f flv' + ' ' + quoted_url ffmpeg_args = shlex.split(ffmpeg_command) - ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) + ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() elif protocol == 'srt': @@ -40,9 +40,9 @@ def publish_with_ffmpeg(url, protocol='rtmp'): quoted_url = urllib.parse.quote(url, safe=':/?=') ffmpeg_command = 'ffmpeg -f lavfi -re -i smptebars=duration=60:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -t 30 -f mpegts udp://127.0.0.1:5000?pkt_size=1316' ffmpeg_args = shlex.split(ffmpeg_command) - ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) + ffmpeg_process = subprocess.Popen(ffmpeg_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) srt_command = ['srt-live-transmit', 'udp://127.0.0.1:5000', '-t', '30', quoted_url] - srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False) + srt_process = subprocess.Popen(srt_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = ffmpeg_process.communicate() srt_stdout, srt_stderr = srt_process.communicate() srt_exit_code = srt_process.returncode From 3bc12035deb387e81305ab9938adb099c780cc46 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Fri, 14 Apr 2023 21:50:50 +0530 Subject: [PATCH 11/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index e7d199ab..4f94ce27 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -1,4 +1,3 @@ -# Used to import the webdriver from selenium import os import time import json From 9ff13a450f0f0c5a462279f347462ce5c3b8e5cb Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Fri, 14 Apr 2023 23:19:49 +0530 Subject: [PATCH 12/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 50 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 4f94ce27..62725541 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -11,7 +11,8 @@ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC -#Function to send notification to Slack + +# Function to send notification to Slack def send_slack_message(webhook_url, message, icon_emoji=":x:"): payload = { "text": message, @@ -24,7 +25,8 @@ def send_slack_message(webhook_url, message, icon_emoji=":x:"): else: print("Slack message sent successfully!") -#Function to start FFMPEG process + +# Function to start FFMPEG process def publish_with_ffmpeg(url, protocol='rtmp'): if protocol == 'rtmp': # Start FFmpeg process for RTMP streaming @@ -47,19 +49,21 @@ def publish_with_ffmpeg(url, protocol='rtmp'): srt_exit_code = srt_process.returncode return srt_exit_code -#Function to close the previous tabs before starting the new test + +# Function to close the previous tabs before starting the new test def switch_to_first_tab(driver): if len(driver.window_handles) > 1: driver.close() driver.switch_to.window(driver.window_handles[0]) -#Function to remove advertisement from sample pages + +# Function to remove advertisement from sample pages def remove_ad(driver): wait = WebDriverWait(driver, 10) button = wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div/button"))) - button.click() - -#Function to switch to new window and close the advertisement block + button.click() + +# Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) time.sleep(2) @@ -67,7 +71,7 @@ def switch_window_and_frame(driver): time.sleep(15) driver.switch_to.frame(0) time.sleep(3) - + webhook_url = os.environ['WEBHOOK_URL'] icon_emoji = ":x:" @@ -81,7 +85,7 @@ def switch_window_and_frame(driver): driver.get("https://antmedia.io/webrtc-samples/") remove_ad(driver) -#Testing Virtual Background Sample Page +# Testing Virtual Background Sample Page for i in range(2): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") @@ -108,7 +112,7 @@ def switch_window_and_frame(driver): switch_to_first_tab(driver) -#Testing WebRTC and HLS Comparison Live Demo Page +# Testing WebRTC and HLS Comparison Live Demo Page try: driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) @@ -127,7 +131,7 @@ def switch_window_and_frame(driver): switch_to_first_tab(driver) -#Testing WebRTC to WebRTC Sample Page +# Testing WebRTC to WebRTC Sample Page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/', '_blank');") switch_window_and_frame(driver) @@ -147,7 +151,7 @@ def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) switch_to_first_tab(driver) -#Testing WebRTC to HLS Sample Page +# Testing WebRTC to HLS Sample Page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-hls-play/', '_blank');") switch_window_and_frame(driver) @@ -167,7 +171,7 @@ def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) switch_to_first_tab(driver) -#Testing WebRTC audio publish sample page +# Testing WebRTC audio publish sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/', '_blank');") switch_window_and_frame(driver) @@ -192,7 +196,7 @@ def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) switch_to_first_tab(driver) -#Testing RTMP to WebRTC sample page +# Testing RTMP to WebRTC sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-webrtc-play/', '_blank');") switch_window_and_frame(driver) @@ -207,7 +211,7 @@ def switch_window_and_frame(driver): switch_to_first_tab(driver) -#Testing RTMP to HLS sample page +# Testing RTMP to HLS sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-hls-play/', '_blank');") switch_window_and_frame(driver) @@ -221,8 +225,8 @@ def switch_window_and_frame(driver): send_slack_message(webhook_url, message, icon_emoji) switch_to_first_tab(driver) - -#Testing SRT to WebRTC sample page + +# Testing SRT to WebRTC sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-webrtc-play/', '_blank');") switch_window_and_frame(driver) @@ -239,8 +243,8 @@ def switch_window_and_frame(driver): send_slack_message(webhook_url, message, icon_emoji) switch_to_first_tab(driver) - -#Testing SRT to HLS sample page + +# Testing SRT to HLS sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-hls-play/', '_blank');") switch_window_and_frame(driver) @@ -251,20 +255,20 @@ def switch_window_and_frame(driver): print("SRT to HLS is successful") else: raise Exception("SRT to HLS test is failed") - + except: message = "SRT to HLS test is failed, check -> https://antmedia.io/webrtc-samples/srt-publish-hls-play/" send_slack_message(webhook_url, message, icon_emoji) switch_to_first_tab(driver) -#Testing WebRTC data channel sample page +# Testing WebRTC data channel sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") switch_window_and_frame(driver) driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() time.sleep(5) - text = driver.find_element(By.ID,'dataTextbox') + text = driver.find_element(By.ID,'dataTextbox') text.send_keys("Hello, how are you ?") driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div/div[2]/button").click() time.sleep(20) @@ -275,5 +279,5 @@ def switch_window_and_frame(driver): except: message = "WebRTC data channel test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-data-channel-only/" send_slack_message(webhook_url, message, icon_emoji) - + driver.quit() From 4b99af7748b1f93a5371e53fee85f49b9b612313 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Fri, 14 Apr 2023 23:30:39 +0530 Subject: [PATCH 13/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 62725541..1451b76b 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -61,7 +61,7 @@ def switch_to_first_tab(driver): def remove_ad(driver): wait = WebDriverWait(driver, 10) button = wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div/button"))) - button.click() + button.click() # Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): @@ -95,11 +95,11 @@ def switch_window_and_frame(driver): time.sleep(20) driver.switch_to.frame(0) time.sleep(3) - driver.find_element(By.XPATH,"/html/body/div/div/div[4]/div[3]/img").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[4]/div[3]/img").click() time.sleep(5) - driver.find_element(By.XPATH,"/html/body/div/div/div[7]/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[7]/button[1]").click() time.sleep(15) - driver.find_element(By.XPATH,"/html/body/div/div/div[7]/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[7]/button[2]").click() time.sleep(3) print("WebRTC virtual background is successful") break @@ -119,9 +119,9 @@ def switch_window_and_frame(driver): time.sleep(2) remove_ad(driver) time.sleep(15) - driver.find_element(By.XPATH,"/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) - driver.find_element(By.XPATH,"/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() time.sleep(3) print("Live demo is successful") @@ -135,11 +135,11 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-webrtc-play/', '_blank');") switch_window_and_frame(driver) - driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[1]").click() time.sleep(10) - driver.find_element(By.XPATH,"/html/body/div/div/div[7]/div[1]/a").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[7]/div[1]/a").click() time.sleep(5) - driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[2]").click() time.sleep(3) print("WebRTC to WebRTC is successful") @@ -155,11 +155,11 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-publish-hls-play/', '_blank');") switch_window_and_frame(driver) - driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[1]").click() time.sleep(10) - driver.find_element(By.XPATH,"/html/body/div/div/div[7]/div[1]/a").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[7]/div[1]/a").click() time.sleep(5) - driver.find_element(By.XPATH,"/html/body/div/div/div[8]/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[8]/button[2]").click() time.sleep(5) print("WebRTC to HLS is successful") @@ -175,16 +175,16 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-audio-publish-play/', '_blank');") switch_window_and_frame(driver) - driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[6]/button[1]").click() time.sleep(3) - driver.find_element(By.XPATH,"/html/body/div/div/div[5]/div[1]/a").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[5]/div[1]/a").click() driver.switch_to.window(driver.window_handles[2]) time.sleep(2) driver.switch_to.frame(0) time.sleep(2) - driver.find_element(By.XPATH,"/html/body/div/div/div[4]/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[4]/button[1]").click() time.sleep(10) - driver.find_element(By.XPATH,"/html/body/div/div/div[4]/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[4]/button[2]").click() time.sleep(2) print("WebRTC audio publish and play is successful") @@ -200,7 +200,7 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-webrtc-play/', '_blank');") switch_window_and_frame(driver) - rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + rtmp_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div") url = rtmp_element.text publish_with_ffmpeg(url, protocol='rtmp') print("RTMP to WebRTC is successful") @@ -215,7 +215,7 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-hls-play/', '_blank');") switch_window_and_frame(driver) - rtmp_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + rtmp_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div") url = rtmp_element.text publish_with_ffmpeg(url, protocol='rtmp') print("RTMP to HLS is successful") @@ -230,7 +230,7 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-webrtc-play/', '_blank');") switch_window_and_frame(driver) - srt_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + srt_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div") url = srt_element.text srt_exit_code = publish_with_ffmpeg(url, protocol='srt') if srt_exit_code == 0: @@ -248,14 +248,14 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-hls-play/', '_blank');") switch_window_and_frame(driver) - srt_element = driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div[1]/div") + srt_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div") url = srt_element.text srt_exit_code = publish_with_ffmpeg(url, protocol='srt') if srt_exit_code == 0: print("SRT to HLS is successful") else: raise Exception("SRT to HLS test is failed") - + except: message = "SRT to HLS test is failed, check -> https://antmedia.io/webrtc-samples/srt-publish-hls-play/" send_slack_message(webhook_url, message, icon_emoji) @@ -266,18 +266,18 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") switch_window_and_frame(driver) - driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[6]/button[1]").click() time.sleep(5) - text = driver.find_element(By.ID,'dataTextbox') + text = driver.find_element(By.ID, 'dataTextbox') text.send_keys("Hello, how are you ?") - driver.find_element(By.XPATH,"/html/body/div/div/div[3]/div/div[2]/button").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div/div[2]/button").click() time.sleep(20) - driver.find_element(By.XPATH,"/html/body/div/div/div[6]/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/div[6]/button[2]").click() time.sleep(3) print("WebRTC data channel is successful") except: message = "WebRTC data channel test is failed, check -> https://antmedia.io/webrtc-samples/webrtc-data-channel-only/" send_slack_message(webhook_url, message, icon_emoji) - + driver.quit() From 1b0def71db1405da667c844f20545a52df16c39c Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Thu, 20 Apr 2023 18:51:51 +0530 Subject: [PATCH 14/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 1451b76b..d7d81c51 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -57,17 +57,9 @@ def switch_to_first_tab(driver): driver.switch_to.window(driver.window_handles[0]) -# Function to remove advertisement from sample pages -def remove_ad(driver): - wait = WebDriverWait(driver, 10) - button = wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[2]/div/button"))) - button.click() - # Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) - time.sleep(2) - remove_ad(driver) time.sleep(15) driver.switch_to.frame(0) time.sleep(3) @@ -83,15 +75,12 @@ def switch_window_and_frame(driver): driver.maximize_window() driver.get("https://antmedia.io/webrtc-samples/") -remove_ad(driver) # Testing Virtual Background Sample Page for i in range(2): try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") driver.switch_to.window(driver.window_handles[1]) - time.sleep(2) - remove_ad(driver) time.sleep(20) driver.switch_to.frame(0) time.sleep(3) @@ -116,8 +105,6 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) - time.sleep(2) - remove_ad(driver) time.sleep(15) driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) From 55a71f43cfa29477c8b2f9a09685c64f1f2e7cdd Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Thu, 20 Apr 2023 18:55:57 +0530 Subject: [PATCH 15/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index d7d81c51..91732d7c 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -8,8 +8,6 @@ from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC # Function to send notification to Slack From b34db6695f8fb9b30617a7377d60297c3578e314 Mon Sep 17 00:00:00 2001 From: murat Date: Wed, 7 Jun 2023 11:35:05 +0300 Subject: [PATCH 16/36] Add AWS autoscale upgrade script --- aws/ant_media_server_aws_cluster_update.py | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 aws/ant_media_server_aws_cluster_update.py diff --git a/aws/ant_media_server_aws_cluster_update.py b/aws/ant_media_server_aws_cluster_update.py new file mode 100644 index 00000000..83ba23bf --- /dev/null +++ b/aws/ant_media_server_aws_cluster_update.py @@ -0,0 +1,98 @@ +import boto3, time +# +# This script terminates the existing instances (expect MongoDB) and recreates them with a new image. +# +ec2_client = boto3.client('ec2') +autoscaling_client = boto3.client('autoscaling') + +# Ant Media Server Enterprise Edition details +Name="AntMedia-AWS-Marketplace-EE-*" +Arch="x86_64" +Owner="679593333241" + +# Don't forget to change your autoscale group names +origin_group_name = 'origin-auto-scaling-group' +edge_group_name = 'edge-auto-scaling-group' + +# Get the latest AMI of Ant Media Server +def image_id(): + + image_response = boto3.client('ec2').describe_images( + Owners=[Owner], + Filters=[ + {'Name': 'name', 'Values': [Name]}, + {'Name': 'architecture', 'Values': [Arch]}, + {'Name': 'root-device-type', 'Values': ['ebs']}, + ], + ) + + ami = sorted(image_response['Images'], + key=lambda x: x['CreationDate'], + reverse=True) + return (ami[0]['ImageId']) + +class AutoscaleSettings: + def __init__(self, autoscaling_client, group_name): + self.autoscaling_client = autoscaling_client + self.group_name = group_name + self.desired_capacity = None + self.min_size = None + self.max_size = None + + def retrieve_settings(self): + response = self.autoscaling_client.describe_auto_scaling_groups(AutoScalingGroupNames=[self.group_name]) + auto_scaling_group = response['AutoScalingGroups'][0] + + self.desired_capacity = auto_scaling_group['DesiredCapacity'] + self.min_size = auto_scaling_group['MinSize'] + self.max_size = auto_scaling_group['MaxSize'] + self.launch_config_name = auto_scaling_group['LaunchConfigurationName'] + response_1 = autoscaling_client.describe_launch_configurations( + LaunchConfigurationNames=[self.launch_config_name] + ) + self.launch_configuration = response_1['LaunchConfigurations'][0] + def update_autoscale(self): + print ("#########", self.group_name, "#########") + print("The instances are terminating.") + terminate_instances = autoscaling_client.update_auto_scaling_group( + AutoScalingGroupName=self.group_name, + MinSize=0, + DesiredCapacity=0, + MaxSize=0, + ) + time.sleep(10) + print ("Creating new Launch Templates") + create_new_launch_template = autoscaling_client.create_launch_configuration( + LaunchConfigurationName=self.launch_config_name + '-updated', + ImageId=str(image_id()), + InstanceType=self.launch_configuration['InstanceType'], + ) + time.sleep(5) + print ("Updating the Auto-Scaling Groups") + update_autoscale = autoscaling_client.update_auto_scaling_group( + AutoScalingGroupName=self.group_name, + LaunchConfigurationName=self.launch_config_name + '-updated' + + ) + time.sleep(10) + print ("New instances are creating with the latest version of Ant Media Server EE") + update_capacity = autoscaling_client.update_auto_scaling_group( + AutoScalingGroupName=self.group_name, + MinSize=self.min_size, + DesiredCapacity=self.desired_capacity, + MaxSize=self.max_size, + ) + print("##################") + + +# Create an instance of the AutoscaleSettings class +origin_settings = AutoscaleSettings(autoscaling_client, origin_group_name) +edge_settings = AutoscaleSettings(autoscaling_client, edge_group_name) + +# Get settings +origin_settings.retrieve_settings() +edge_settings.retrieve_settings() + +# Update Auto-Scaling +origin_settings.update_autoscale() +edge_settings.update_autoscale() From 80ea48ebeb0bc87035fa14d3a174fbeefe33441f Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:49:23 +0530 Subject: [PATCH 17/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 41 +++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 91732d7c..6d9eca53 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -8,6 +8,8 @@ from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC # Function to send notification to Slack @@ -47,6 +49,10 @@ def publish_with_ffmpeg(url, protocol='rtmp'): srt_exit_code = srt_process.returncode return srt_exit_code +#Function to remove advertisement from sample pages +def remove_ad(driver): + element = driver.find_element(By.XPATH, "/html/body/div[3]/div") + driver.execute_script("arguments[0].style.display = 'none';", element) # Function to close the previous tabs before starting the new test def switch_to_first_tab(driver): @@ -54,11 +60,12 @@ def switch_to_first_tab(driver): driver.close() driver.switch_to.window(driver.window_handles[0]) - # Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) - time.sleep(15) + time.sleep(10) + remove_ad(driver) + time.sleep(2) driver.switch_to.frame(0) time.sleep(3) @@ -73,6 +80,7 @@ def switch_window_and_frame(driver): driver.maximize_window() driver.get("https://antmedia.io/webrtc-samples/") +#remove_ad(driver) # Testing Virtual Background Sample Page for i in range(2): @@ -80,6 +88,8 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) + remove_ad(driver) + time.sleep(2) driver.switch_to.frame(0) time.sleep(3) driver.find_element(By.XPATH, "/html/body/div/div/div[4]/div[3]/img").click() @@ -103,10 +113,12 @@ def switch_window_and_frame(driver): try: driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) + time.sleep(20) + remove_ad(driver) + time.sleep(2) + driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) - driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() - time.sleep(15) - driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() time.sleep(3) print("Live demo is successful") @@ -247,6 +259,25 @@ def switch_window_and_frame(driver): switch_to_first_tab(driver) +# Testing DeepAR sample page +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/deepar-publish-play/', '_blank');") + switch_window_and_frame(driver) + driver.find_element(By.XPATH, "/html/body/div/div/select").click() + time.sleep(1) + driver.find_element(By.XPATH, "/html/body/div[1]/div/select/option[6]").click() + time.sleep(1) + driver.find_element(By.XPATH, "/html/body/div[1]/div/div[5]/button[1]").click() + time.sleep(10) + driver.find_element(By.XPATH, "/html/body/div[1]/div/div[5]/button[2]").click() + print("WebRTC Deep AR test is successful") + +except: + message = "WebRTC DeepAR sample test is failed, check -> https://antmedia.io/webrtc-samples/deepar-publish-play/" + send_slack_message(webhook_url, message, icon_emoji) + +switch_to_first_tab(driver) + # Testing WebRTC data channel sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") From c0f316429cd8af3412024b1d63ace2f9f9235b26 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:55:15 +0530 Subject: [PATCH 18/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index 6d9eca53..e34da996 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -49,7 +49,7 @@ def publish_with_ffmpeg(url, protocol='rtmp'): srt_exit_code = srt_process.returncode return srt_exit_code -#Function to remove advertisement from sample pages +# Function to remove advertisement from sample pages def remove_ad(driver): element = driver.find_element(By.XPATH, "/html/body/div[3]/div") driver.execute_script("arguments[0].style.display = 'none';", element) @@ -80,7 +80,6 @@ def switch_window_and_frame(driver): driver.maximize_window() driver.get("https://antmedia.io/webrtc-samples/") -#remove_ad(driver) # Testing Virtual Background Sample Page for i in range(2): From d0fcbded688394bd83f165fe8d762c807c6ea75e Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:09:35 +0530 Subject: [PATCH 19/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index e34da996..ff837b6e 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -8,8 +8,6 @@ from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC # Function to send notification to Slack @@ -49,17 +47,20 @@ def publish_with_ffmpeg(url, protocol='rtmp'): srt_exit_code = srt_process.returncode return srt_exit_code + # Function to remove advertisement from sample pages def remove_ad(driver): element = driver.find_element(By.XPATH, "/html/body/div[3]/div") driver.execute_script("arguments[0].style.display = 'none';", element) + # Function to close the previous tabs before starting the new test def switch_to_first_tab(driver): if len(driver.window_handles) > 1: driver.close() driver.switch_to.window(driver.window_handles[0]) + # Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) @@ -69,6 +70,7 @@ def switch_window_and_frame(driver): driver.switch_to.frame(0) time.sleep(3) + webhook_url = os.environ['WEBHOOK_URL'] icon_emoji = ":x:" @@ -194,12 +196,12 @@ def switch_window_and_frame(driver): # Testing RTMP to WebRTC sample page try: - driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-webrtc-play/', '_blank');") - switch_window_and_frame(driver) - rtmp_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div") - url = rtmp_element.text - publish_with_ffmpeg(url, protocol='rtmp') - print("RTMP to WebRTC is successful") + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/rtmp-publish-webrtc-play/', '_blank');") + switch_window_and_frame(driver) + rtmp_element = driver.find_element(By.XPATH, "/html/body/div/div/div[3]/div[1]/div") + url = rtmp_element.text + publish_with_ffmpeg(url, protocol='rtmp') + print("RTMP to WebRTC is successful") except: message = "RTMP to WebRTC test is failed, check -> https://antmedia.io/webrtc-samples/rtmp-publish-wertc-play/" @@ -239,7 +241,7 @@ def switch_window_and_frame(driver): send_slack_message(webhook_url, message, icon_emoji) switch_to_first_tab(driver) - + # Testing SRT to HLS sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/srt-publish-hls-play/', '_blank');") From 9e121e33cc7cdedc6279141ffb35cd91ab71790d Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 00:17:57 +0300 Subject: [PATCH 20/36] Add usage --- aws/ant_media_server_aws_cluster_update.py | 39 +++++++++++++++++----- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/aws/ant_media_server_aws_cluster_update.py b/aws/ant_media_server_aws_cluster_update.py index 83ba23bf..444619b5 100644 --- a/aws/ant_media_server_aws_cluster_update.py +++ b/aws/ant_media_server_aws_cluster_update.py @@ -1,7 +1,34 @@ -import boto3, time -# -# This script terminates the existing instances (expect MongoDB) and recreates them with a new image. -# +import boto3, time, argparse + +""" +ant_media_server_aws_cluster_update.py + +Description: This script terminates the existing instances (except MongoDB) and recreates them with a new image. + +Usage: + python your_script.py --origin --edge + +Options: + -h, --help Show this help message and exit + --origin Specify the name of the origin autoscaling group + --edge Specify the name of the edge autoscaling group + +Examples: + python ant_media_server_aws_cluster_update.py --origin origin-auto-scaling-group --edge edge-auto-scaling-group +""" + +if __name__ == "__main__": + # Parse command line arguments + parser = argparse.ArgumentParser(description='Your script description') + parser.add_argument('--origin', type=str, help='Specify the name of the origin autoscaling group') + parser.add_argument('--edge', type=str, help='Specify the name of the edge autoscaling group') + args = parser.parse_args() + + # Assign the provided autoscaling group names to the respective variables + origin_group_name = args.origin + edge_group_name = args.edge + + ec2_client = boto3.client('ec2') autoscaling_client = boto3.client('autoscaling') @@ -10,10 +37,6 @@ Arch="x86_64" Owner="679593333241" -# Don't forget to change your autoscale group names -origin_group_name = 'origin-auto-scaling-group' -edge_group_name = 'edge-auto-scaling-group' - # Get the latest AMI of Ant Media Server def image_id(): From ab01bcf5568108e3b3577545c64ac7cb1a8cb60c Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 00:18:25 +0300 Subject: [PATCH 21/36] Update ant_media_server_aws_cluster_update.py --- aws/ant_media_server_aws_cluster_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/ant_media_server_aws_cluster_update.py b/aws/ant_media_server_aws_cluster_update.py index 444619b5..b1877fff 100644 --- a/aws/ant_media_server_aws_cluster_update.py +++ b/aws/ant_media_server_aws_cluster_update.py @@ -6,7 +6,7 @@ Description: This script terminates the existing instances (except MongoDB) and recreates them with a new image. Usage: - python your_script.py --origin --edge + python ant_media_server_aws_cluster_update.py --origin --edge Options: -h, --help Show this help message and exit From 17604f3e67a6cb584dbdec522ade0475d5603607 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 00:23:05 +0300 Subject: [PATCH 22/36] Add shebang --- aws/ant_media_server_aws_cluster_update.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws/ant_media_server_aws_cluster_update.py b/aws/ant_media_server_aws_cluster_update.py index b1877fff..daf977dc 100644 --- a/aws/ant_media_server_aws_cluster_update.py +++ b/aws/ant_media_server_aws_cluster_update.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import boto3, time, argparse """ From 33b55d3bcb3d7c34d1e30b97b14574521ac2ef7d Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 10:12:53 +0300 Subject: [PATCH 23/36] Update install_mongodb.sh --- install_mongodb.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/install_mongodb.sh b/install_mongodb.sh index 50864959..574e07c5 100644 --- a/install_mongodb.sh +++ b/install_mongodb.sh @@ -9,3 +9,21 @@ curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg --dearmor --yes --o echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list sudo apt-get update sudo apt-get install -y mongodb-org + +# Generate a random username and password +username=$(openssl rand -hex 6) +password=$(openssl rand -hex 12) + +# Start MongoDB and configure authentication +sudo systemctl restart mongod + +sleep 10 + +echo "use admin; +db.createUser({ user: '$username', pwd: '$password', roles: ['root'], mechanisms: ['SCRAM-SHA-1'] });" | mongosh + +sudo sed -i 's/#security:/security:\n authorization: "enabled"/g' /etc/mongod.conf +sudo systemctl restart mongod + +echo "MongoDB username: $username" +echo "MongoDB password: $password" From 84337f87be7d716f299fa1699596a39e629d7cfb Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 10:14:16 +0300 Subject: [PATCH 24/36] Add enable startup --- install_mongodb.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install_mongodb.sh b/install_mongodb.sh index 574e07c5..843355bc 100644 --- a/install_mongodb.sh +++ b/install_mongodb.sh @@ -16,6 +16,7 @@ password=$(openssl rand -hex 12) # Start MongoDB and configure authentication sudo systemctl restart mongod +sudo systemctl enable mongod sleep 10 From cc28a1f91c560714d2efc8f840edca37a57632c6 Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 26 Jun 2023 14:53:37 +0530 Subject: [PATCH 25/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 39 +++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index ff837b6e..f8f8688c 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -48,12 +48,6 @@ def publish_with_ffmpeg(url, protocol='rtmp'): return srt_exit_code -# Function to remove advertisement from sample pages -def remove_ad(driver): - element = driver.find_element(By.XPATH, "/html/body/div[3]/div") - driver.execute_script("arguments[0].style.display = 'none';", element) - - # Function to close the previous tabs before starting the new test def switch_to_first_tab(driver): if len(driver.window_handles) > 1: @@ -65,8 +59,6 @@ def switch_to_first_tab(driver): def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) time.sleep(10) - remove_ad(driver) - time.sleep(2) driver.switch_to.frame(0) time.sleep(3) @@ -89,8 +81,6 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) - remove_ad(driver) - time.sleep(2) driver.switch_to.frame(0) time.sleep(3) driver.find_element(By.XPATH, "/html/body/div/div/div[4]/div[3]/img").click() @@ -115,11 +105,9 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) - remove_ad(driver) - time.sleep(2) - driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) - driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() + driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(3) print("Live demo is successful") @@ -279,6 +267,29 @@ def switch_window_and_frame(driver): switch_to_first_tab(driver) +try: + driver.execute_script("window.open('https://antmedia.io/webrtc-samples/interactive-whiteboard-publish-play/', '_blank');") + switch_window_and_frame(driver) + driver.switch_to.frame("webrtc-publish-frame") + time.sleep(1) + driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[2]/div[6]/button[1]").click() + time.sleep(5) + driver.switch_to.frame(0) + driver.find_element(By.XPATH, "/html/body/section[2]/canvas[4]").click() + time.sleep(2) + driver.switch_to.default_content() + driver.switch_to.frame(0) + driver.switch_to.frame("webrtc-play-frame") + driver.find_element(By.XPATH, "/html/body/div[2]/div/div/div/div[3]/div[4]/button[1]").click() + time.sleep(10) + print("WebRTC white board test is successful") + +except: + message = "WebRTC whiteboard test is failed, check -> https://antmedia.io/webrtc-samples/interactive-whiteboard-publish-play/" + send_slack_message(webhook_url, message, icon_emoji) + +switch_to_first_tab(driver) + # Testing WebRTC data channel sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-data-channel-only/', '_blank');") From 917fb811aabe3b9f6308112e8bfd2956fe1b21a2 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 12:54:22 +0300 Subject: [PATCH 26/36] Update bindIP setting --- install_mongodb.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install_mongodb.sh b/install_mongodb.sh index 843355bc..b2e222d6 100644 --- a/install_mongodb.sh +++ b/install_mongodb.sh @@ -24,6 +24,7 @@ echo "use admin; db.createUser({ user: '$username', pwd: '$password', roles: ['root'], mechanisms: ['SCRAM-SHA-1'] });" | mongosh sudo sed -i 's/#security:/security:\n authorization: "enabled"/g' /etc/mongod.conf +sudo sed -i 's/bindIp:.*/bindIp: 0.0.0.0/g' /etc/mongod.conf sudo systemctl restart mongod echo "MongoDB username: $username" From 7fe537a1409219e9064336e2a0ec4ec01663d969 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Mon, 26 Jun 2023 13:25:23 +0300 Subject: [PATCH 27/36] Add without username/password installation --- install_mongodb.sh | 51 +++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/install_mongodb.sh b/install_mongodb.sh index b2e222d6..366a9368 100644 --- a/install_mongodb.sh +++ b/install_mongodb.sh @@ -2,6 +2,20 @@ # # MongoDB Installation Script # + +help() { + echo "Usage: $0" + echo "" + echo "Options:" + echo " --auto-create Automatically create a MongoDB user with a random username and password" + echo " --help Show this help menu" +} + +if [ $1 == "--help" ]; then + help + exit 1 +fi + export DEBIAN_FRONTEND=noninteractive sudo apt-get update sudo apt-get install -y curl gnupg2 @@ -10,22 +24,31 @@ echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg sudo apt-get update sudo apt-get install -y mongodb-org -# Generate a random username and password -username=$(openssl rand -hex 6) -password=$(openssl rand -hex 12) +if [[ $1 == "--auto-create" ]]; then + # Generate a random username and password + username=$(openssl rand -hex 6) + password=$(openssl rand -hex 12) + + # Start MongoDB and configure authentication + sudo systemctl restart mongod + sudo systemctl enable mongod -# Start MongoDB and configure authentication -sudo systemctl restart mongod -sudo systemctl enable mongod + sleep 10 -sleep 10 + echo "use admin; + db.createUser({ user: '$username', pwd: '$password', roles: ['root'], mechanisms: ['SCRAM-SHA-1'] });" | mongosh -echo "use admin; -db.createUser({ user: '$username', pwd: '$password', roles: ['root'], mechanisms: ['SCRAM-SHA-1'] });" | mongosh + sudo sed -i 's/#security:/security:\n authorization: "enabled"/g' /etc/mongod.conf + sudo sed -i 's/bindIp:.*/bindIp: 0.0.0.0/g' /etc/mongod.conf + sudo systemctl restart mongod -sudo sed -i 's/#security:/security:\n authorization: "enabled"/g' /etc/mongod.conf -sudo sed -i 's/bindIp:.*/bindIp: 0.0.0.0/g' /etc/mongod.conf -sudo systemctl restart mongod + echo "MongoDB username: $username" + echo "MongoDB password: $password" +else + # Start MongoDB without authentication + sudo sed -i 's/bindIp:.*/bindIp: 0.0.0.0/g' /etc/mongod.conf + sudo systemctl restart mongod + sudo systemctl enable mongod -echo "MongoDB username: $username" -echo "MongoDB password: $password" + echo "MongoDB installed without username and password" +fi From 1f5bda580776d25ec88f7cc298a44d45d787103c Mon Sep 17 00:00:00 2001 From: yashtandon113 <82374739+yashtandon113@users.noreply.github.com> Date: Mon, 3 Jul 2023 01:55:27 +0530 Subject: [PATCH 28/36] Update antmedia-samples.py --- Selenium/antmedia-samples.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Selenium/antmedia-samples.py b/Selenium/antmedia-samples.py index f8f8688c..1a315b1e 100644 --- a/Selenium/antmedia-samples.py +++ b/Selenium/antmedia-samples.py @@ -55,10 +55,18 @@ def switch_to_first_tab(driver): driver.switch_to.window(driver.window_handles[0]) +# Function to remove advertisement from sample pages +def remove_ad(driver): + element = driver.find_element(By.XPATH, "/html/body/div[3]/div") + driver.execute_script("arguments[0].style.display = 'none';", element) + + # Function to switch to new window and close the advertisement block def switch_window_and_frame(driver): driver.switch_to.window(driver.window_handles[1]) time.sleep(10) + remove_ad(driver) + time.sleep(2) driver.switch_to.frame(0) time.sleep(3) @@ -81,6 +89,8 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/webrtc-samples/webrtc-virtual-background/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) + remove_ad(driver) + time.sleep(2) driver.switch_to.frame(0) time.sleep(3) driver.find_element(By.XPATH, "/html/body/div/div/div[4]/div[3]/img").click() @@ -105,9 +115,11 @@ def switch_window_and_frame(driver): driver.execute_script("window.open('https://antmedia.io/live-demo/', '_blank');") driver.switch_to.window(driver.window_handles[1]) time.sleep(20) - driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() + remove_ad(driver) + time.sleep(2) + driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() time.sleep(15) - driver.find_element(By.XPATH, "/html/body/div/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[1]").click() + driver.find_element(By.XPATH, "/html/body/div[5]/div/article[2]/div[2]/div[1]/div[1]/div/div/p/button[2]").click() time.sleep(3) print("Live demo is successful") @@ -267,6 +279,7 @@ def switch_window_and_frame(driver): switch_to_first_tab(driver) +# Testing Whiteboard sample page try: driver.execute_script("window.open('https://antmedia.io/webrtc-samples/interactive-whiteboard-publish-play/', '_blank');") switch_window_and_frame(driver) From de589b46898ad2805d65c428d42f2a5b694ddf2d Mon Sep 17 00:00:00 2001 From: murat Date: Fri, 7 Jul 2023 12:45:08 +0300 Subject: [PATCH 29/36] Remove busybox for conflict --- install_ant-media-server.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 3b443342..7061f5b4 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -287,8 +287,9 @@ REQUIRED_VERSION="2.6" if [ "$ID" == "ubuntu" ]; then $SUDO apt-get update -y $SUDO apt-get install unzip zip libva-drm2 libva-x11-2 libvdpau-dev -y - VERSION=$(unzip -p "$ANT_MEDIA_SERVER_ZIP_FILE" ant-media-server/ant-media-server.jar | busybox unzip -p - | grep -a "Implementation-Version"|cut -d' ' -f2 | tr -d '\r') - + $SUDO unzip -o $ANT_MEDIA_SERVER_ZIP_FILE "ant-media-server/ant-media-server.jar" -d /tmp/ + VERSION=$(unzip -p /tmp/ant-media-server/ant-media-server.jar | grep -a "Implementation-Version"|cut -d' ' -f2 | tr -d '\r') + # If the version is lower than 2.6 and the architecture is x86_64, install the libcrystalhd-dev package. # Additionally, arm64 architecture does not have libcrystalhd-dev and the following check will fix the installation problem in ARM. # After 2.6, there is no dependency to libcrystalhd-dev From 2c1ad271e6b217dafb7794bcf8833219ca1b8e96 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 7 Jul 2023 12:52:40 +0300 Subject: [PATCH 30/36] Update install_mongodb.sh --- install_mongodb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_mongodb.sh b/install_mongodb.sh index 366a9368..916a2571 100644 --- a/install_mongodb.sh +++ b/install_mongodb.sh @@ -11,7 +11,7 @@ help() { echo " --help Show this help menu" } -if [ $1 == "--help" ]; then +if [ "$1" == "--help" ]; then help exit 1 fi From 5b3c7f62d4468757bebc31d4056d70e6c2f1014c Mon Sep 17 00:00:00 2001 From: murat Date: Fri, 7 Jul 2023 17:35:40 +0300 Subject: [PATCH 31/36] Add auto download feature --- docker/Dockerfile_Process | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile_Process b/docker/Dockerfile_Process index f25b2dec..1f3f92e5 100644 --- a/docker/Dockerfile_Process +++ b/docker/Dockerfile_Process @@ -5,6 +5,7 @@ FROM ubuntu:20.04 ARG AntMediaServer +ARG LicenseKey ARG BranchName=master @@ -20,7 +21,13 @@ RUN cd home \ RUN cd home \ && pwd \ - && ./install_ant-media-server.sh -i ${AntMediaServer} -s false + && if [ -n "$AntMediaServer" ]; then \ + ./install_ant-media-server.sh -i ${AntMediaServer} -s false; \ + fi \ + && if [ -n "$LicenseKey" ]; then \ + ./install_ant-media-server.sh -l ${LicenseKey} -s false; \ + fi + # Options From 3c1277e84c183329c77db3767f3ce97686e039b3 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Thu, 3 Aug 2023 00:26:09 +0300 Subject: [PATCH 32/36] Add file pattern for 0.0.0.0_access log files in logrotate configuration --- install_ant-media-server.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 3b443342..4eb929ce 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -433,6 +433,20 @@ cat << EOF | $SUDO tee /etc/logrotate.d/antmedia reload rsyslog >/dev/null 2>&1 || true endscript } +/var/log/antmedia/0.0.0.0_access*.log { + daily + create 644 antmedia antmedia + rotate 7 + maxsize 50M + compress + delaycompress + copytruncate + notifempty + sharedscripts + postrotate + reload rsyslog >/dev/null 2>&1 || true + endscript +} EOF check From 62782d78b69174a0d30e95d0b7e7475dc071b06d Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Thu, 3 Aug 2023 00:28:57 +0300 Subject: [PATCH 33/36] Remove standard output in logrotate file --- install_ant-media-server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 4eb929ce..4d74d871 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -418,7 +418,7 @@ then fi # create a logrotate config file -cat << EOF | $SUDO tee /etc/logrotate.d/antmedia +cat << EOF | $SUDO tee /etc/logrotate.d/antmedia > /dev/null /var/log/antmedia/antmedia-error.log { daily create 644 antmedia antmedia From 760914925788e8dc179e6d87b1fea34ffa5f98b9 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Thu, 3 Aug 2023 07:49:41 +0300 Subject: [PATCH 34/36] Fix "tzdb.dat" error by installing "tzdata-java" package --- install_ant-media-server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 3b443342..cf988009 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -357,7 +357,7 @@ else $SUDO apt-get install openjdk-11-jre-headless -y check elif [ "$ID" == "centos" ] || [ "$ID" == "almalinux" ] || [ "$ID" == "rocky" ] || [ "$ID" == "rhel" ]; then - $SUDO yum -y install java-11-openjdk-headless + $SUDO yum -y install java-11-openjdk-headless tzdata-java ln -s $(readlink -f $(which java) | rev | cut -d "/" -f3- | rev) /usr/lib/jvm/java-11-openjdk-amd64 fi echo "export JAVA_HOME=\/usr\/lib\/jvm\/java-11-openjdk-amd64/" >>~/.bashrc From df403bd1bfa5a4bcecfc12ceaaa2ef49885950a4 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Sat, 16 Sep 2023 08:15:29 +0300 Subject: [PATCH 35/36] Refactor Dockerfile for conditional AntMediaServer and LicenseKey installation --- docker/Dockerfile_Process | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile_Process b/docker/Dockerfile_Process index 1f3f92e5..dd1534af 100644 --- a/docker/Dockerfile_Process +++ b/docker/Dockerfile_Process @@ -19,17 +19,17 @@ RUN cd home \ && wget https://raw.githubusercontent.com/ant-media/Scripts/${BranchName}/install_ant-media-server.sh \ && chmod 755 install_ant-media-server.sh -RUN cd home \ +RUN cd /home \ && pwd \ && if [ -n "$AntMediaServer" ]; then \ ./install_ant-media-server.sh -i ${AntMediaServer} -s false; \ - fi \ - && if [ -n "$LicenseKey" ]; then \ + elif [ -n "$LicenseKey" ]; then \ ./install_ant-media-server.sh -l ${LicenseKey} -s false; \ + else \ + echo "Both AntMediaServer and LicenseKey arguments are not provided. Aborting the build process."; \ + exit 1; \ fi - - # Options # -g: Use global(Public) IP in network communication. Its value can be true or false. Default value is false. # From f42b718bc0e74bb34dc3c115784900a6817f9f5c Mon Sep 17 00:00:00 2001 From: Mohit Dubey <86982446+Mohit-3196@users.noreply.github.com> Date: Sun, 17 Sep 2023 13:59:10 +0530 Subject: [PATCH 36/36] Update vod_transcode.sh script to correct the file name and add the missing character in the m3u8 --- vod_transcode.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vod_transcode.sh b/vod_transcode.sh index 56c3ce93..942377f2 100644 --- a/vod_transcode.sh +++ b/vod_transcode.sh @@ -26,4 +26,4 @@ c=("320x240" "800k") cd /usr/local/antmedia/webapps/$AMS_APP_NAME/streams/ -$(command -v ffmpeg) -i $file -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -s:v:0 ${a[0]} -c:v:0 libx264 -b:v:0 ${a[1]} -s:v:1 ${b[0]} -c:v:1 libx264 -b:v:1 ${b[1]} -s:v:2 ${c[0]} -c:v:2 libx264 -b:v:2 ${c[1]} -c:a aac -f hls -hls_playlist_type vod -master_pl_name ${file_name}.m3u8 -hls_segment_filename ${file_name}_%v/${file_name}%03d.ts -use_localtime_mkdir 1 -var_stream_map "v:0,a:0,name:720p v:1,a:1,name:480p v:2,a:2,name:360p" ${file_name}_%v.m3u \ No newline at end of file +$(command -v ffmpeg) -i $file -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -s:v:0 ${a[0]} -c:v:0 libx264 -b:v:0 ${a[1]} -s:v:1 ${b[0]} -c:v:1 libx264 -b:v:1 ${b[1]} -s:v:2 ${c[0]} -c:v:2 libx264 -b:v:2 ${c[1]} -c:a aac -f hls -hls_playlist_type vod -master_pl_name ${file_name}.m3u8 -hls_segment_filename ${file_name}_%v/${file_name}%04d.ts -use_localtime_mkdir 1 -var_stream_map "v:0,a:0,name:720p v:1,a:1,name:480p v:2,a:2,name:360p" ${file_name}_%v.m3u8