Skip to content

Instantly share code, notes, and snippets.

@mekya
mekya / SampleHandler.swift
Created July 8, 2023 13:57
Broadcast Extension
//
// SampleHandler.swift
// BroadcastScreen
//
// Created by mekya on 08/07/2023.
//
import ReplayKit
import WebRTCiOSSDK
@mekya
mekya / ConferenceViewController.swift
Created March 2, 2023 08:33
ConferenceViewController uses external camera
//
// ConferenceViewController.swift
// AntMediaReferenceApplication
//
// Created by mekya on 13.08.2020.
// Copyright © 2020 AntMedia. All rights reserved.
//
import UIKit
import Foundation
@mekya
mekya / VideoViewController.swift
Created February 16, 2023 14:37
Open Camera and use External Video Frame for iOS
//
// VideoViewController.swift
// AntMediaReferenceApplication
//
//
import UIKit
import WebRTC
import AVFoundation
import WebRTCiOSSDK
@mekya
mekya / HLSServlet.java
Created February 15, 2022 13:00
This servlet just add query string to the ts in m3u8 file
package io.antmedia.enterprise.streamapp;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
import java.util.ArrayList;
import org.apache.catalina.WebResource;
import java.io.FileNotFoundException;
import javax.servlet.DispatcherType;
@mekya
mekya / load_rtmp.sh
Last active July 4, 2021 08:52
Give RTMP load to the Ant Media Server
#!/bin/bash
##
## This script sends number of Big Buck Bunny video(2119 Kbps 1280x720) to the Ant Media Server via RTMP for load testing.
## first parameter is the number of rtmp stream to send the server
## second parameter is the server address to send that rtmp streams
##
## Sample usage
## ./load_rtmp.sh 100 172.99.22.33
## Above script send 100 RTMP streams to the Ant Media Server running in 172.99.22.33
@mekya
mekya / custom_player_according_to_speed_hls.html
Last active August 7, 2021 06:15
Checks the stream speed and plays it accordingly
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ant Media Server WebRTC/HLS Player</title>
<!-- videojs includes -->
<link href="css/external/video-js.css" rel="stylesheet">
<script src="js/external/video.js"></script>
@mekya
mekya / custom_player_according_to_speed.html
Last active May 16, 2021 08:12
Custom player - plays the rtmp or stream source if it's broadcasting and speed is high enough
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Ant Media Server WebRTC/HLS Player</title>
<!-- videojs includes -->
<link href="css/external/video-js.css" rel="stylesheet">
<script src="js/external/video.js"></script>
@mekya
mekya / canvas_add_mix_html_player_audio_and_mic
Created December 4, 2020 10:27
This code makes three things. First, capture canvas stream, second mix html5 player's audio and mic audio into a single audio track, lastly publish the stream to the Ant Media Server
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
@mekya
mekya / multiTrackTest.sh
Created November 18, 2020 11:32
Multi Track Publish to the Server
#!/bin/bash
#login
echo "login"
SERVER_ADDR=172.16.110.178
APP_NAME=WebRTCAppEE
FILE_1=~/git/Ant-Media-Server/src/test/resources/test.flv #Clash_360z.mp4
FILE_2=~/git/Ant-Media-Server/src/test/resources/test_video_360p.flv #Carz.mp4
STREAM_ID_1=stream_multi_track
@mekya
mekya / custom_canvas.html
Last active February 14, 2022 09:54
Custom canvas streaming in Ant Media Server
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<style>