forked from OpenVidu/openvidu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openvidu-test-e2e: custom layout recording test
1 parent
6a86703
commit 3056d21
Showing
8 changed files
with
266 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...st-browsers/src/main/java/io/openvidu/test/browsers/utils/layout/CustomLayoutHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.openvidu.test.browsers.utils.layout; | ||
|
||
import java.util.concurrent.CountDownLatch; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.builder.SpringApplicationBuilder; | ||
import org.springframework.boot.context.event.ApplicationReadyEvent; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@SpringBootApplication | ||
public class CustomLayoutHandler extends WebSecurityConfigurerAdapter implements WebMvcConfigurer { | ||
|
||
private static ConfigurableApplicationContext context; | ||
public static CountDownLatch initLatch; | ||
|
||
public static void main(String[] args, CountDownLatch initLatch) { | ||
CustomLayoutHandler.initLatch = initLatch; | ||
CustomLayoutHandler.context = new SpringApplicationBuilder(CustomLayoutHandler.class) | ||
.properties("spring.config.location:classpath:aplication-pro-layout-handler.properties").build() | ||
.run(args); | ||
} | ||
|
||
@Override | ||
protected void configure(HttpSecurity security) throws Exception { | ||
security.httpBasic().disable(); | ||
} | ||
|
||
@EventListener(ApplicationReadyEvent.class) | ||
public void afterStartup() { | ||
CustomLayoutHandler.initLatch.countDown(); | ||
} | ||
|
||
public static void shutDown() { | ||
CustomLayoutHandler.context.close(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
openvidu-test-browsers/src/main/resources/aplication-pro-layout-handler.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
server.port=5555 | ||
server.ssl.enabled=false | ||
security.basic.enabled=false |
55 changes: 55 additions & 0 deletions
55
openvidu-test-browsers/src/main/resources/static/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<html> | ||
|
||
<head> | ||
<script> | ||
const xmlHttp = new XMLHttpRequest(); | ||
xmlHttp.open('GET', 'https://api.github.com/repos/OpenVidu/openvidu/releases/latest', false); | ||
xmlHttp.send(null); | ||
const response = JSON.parse(xmlHttp.responseText); | ||
const version = response.tag_name.replace(/^v/, ''); | ||
const newScript = document.createElement('script'); | ||
newScript.src = 'https://github.com/OpenVidu/openvidu/releases/download/v' + version + | ||
'/openvidu-browser-' + version + '.min.js'; | ||
document.getElementsByTagName('head')[0].appendChild(newScript); | ||
newScript.onload = () => { | ||
startOpenVidu(); | ||
}; | ||
</script> | ||
</script> | ||
<style> | ||
video { | ||
height: 5px !important; | ||
width: 10px !important; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body style='background-color: red'> | ||
<div id='videos'></div> | ||
</body> | ||
|
||
<script> | ||
function startOpenVidu() { | ||
var url = new URL(window.location.href); | ||
var SESSION_ID = url.searchParams.get('sessionId'); | ||
var SECRET = url.searchParams.get('secret'); | ||
var TOKEN = 'wss://' + location.hostname + ':4443?sessionId=' + SESSION_ID + '&secret=' + SECRET + | ||
'&recorder=true'; | ||
|
||
var OV = new OpenVidu(); | ||
var session = OV.initSession(); | ||
|
||
session.on('streamCreated', (event) => { | ||
session.subscribe(event.stream, 'videos'); | ||
}); | ||
session.connect(TOKEN) | ||
.then(() => { | ||
console.log('Recorder participant connected') | ||
}) | ||
.catch(error => { | ||
console.error(error) | ||
}); | ||
} | ||
</script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.