Skip to content

Commit

Permalink
New webhooks playStart, playStop, recordStart issue #4666
Browse files Browse the repository at this point in the history
  • Loading branch information
lastpeony committed Jan 17, 2023
1 parent 878221c commit 60b0a20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/main/java/io/antmedia/AntMediaApplicationAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,9 @@ public void resetDASHStats(String streamId) {

public void sendStartPlayWebHook(final String streamId, final String viewerId){
final Broadcast broadcast = getDataStore().get(streamId);
if(broadcast == null){
return;
}
final String listenerHookURL = broadcast.getListenerHookURL();
if (listenerHookURL == null || listenerHookURL.isEmpty()) {
return;
Expand All @@ -553,6 +556,9 @@ public void sendStartPlayWebHook(final String streamId, final String viewerId){

public void sendStopPlayWebHook(final String streamId, final String viewerId){
final Broadcast broadcast = getDataStore().get(streamId);
if(broadcast == null){
return;
}
final String listenerHookURL = broadcast.getListenerHookURL();
if (listenerHookURL == null || listenerHookURL.isEmpty()) {
return;
Expand All @@ -566,6 +572,9 @@ public void sendStopPlayWebHook(final String streamId, final String viewerId){

public void sendStartRecordWebHook(final String streamId){
final Broadcast broadcast = getDataStore().get(streamId);
if(broadcast == null){
return;
}
final String listenerHookURL = broadcast.getListenerHookURL();
if (listenerHookURL == null || listenerHookURL.isEmpty()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ public void testRtmpStreamPlayStop() throws Exception {

spyAdaptor.streamPlayItemPlay(stream, item, true);
verify(spyAdaptor, times(1)).sendStartPlayWebHook(anyString(), anyString());
Awaitility.await().atMost(2, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
Awaitility.await().atMost(5, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
()-> {
boolean called = false;
try{
Expand All @@ -1883,7 +1883,7 @@ public void testRtmpStreamPlayStop() throws Exception {

spyAdaptor.streamPlayItemStop(stream, item);
verify(spyAdaptor, times(1)).sendStopPlayWebHook(anyString(), anyString());
Awaitility.await().atMost(2, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
Awaitility.await().atMost(5, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(
()-> {
boolean called = false;
try{
Expand Down

0 comments on commit 60b0a20

Please sign in to comment.