Skip to content

Instantly share code, notes, and snippets.

@mekya
mekya / device_orientation.html
Created January 27, 2014 13:00
How to get device orientation angles(alpha, beta, gamma) in HTML5. It draws circle and rectangles according to angle(alpha, beta, gamma) values
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="360" height="450" style="border:1px solid #d3d3d3;">
</canvas>
<script>
function deviceOrientationListener(event) {
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
@mekya
mekya / build.gradle
Last active July 30, 2017 10:07
Export War file from Eclipse Web Project with Gradle -- hope it saves some time for gradle newbies like me
//Export War file from Eclipse Web Project with Gradle
// we need to use war plugin
apply plugin: 'war'
//default webAppDirName in gradle is not "WebContent" but
// it is default in eclise so change it according to eclipse layout
// it encapsulates all files under webAppDirName
webAppDirName = 'WebContent'
@mekya
mekya / ffmpeg_shared_lib_build_with_fdk_aac_and_x264
Created July 19, 2014 16:44
javacpp-preset's ffmpeg build with fdk-aac for android
if [[ -z "$PLATFORM" ]]; then
echo "This file is meant to be included by the parent cppbuild.sh script"
exit 1
fi
if [[ $PLATFORM == windows* ]]; then
FFMPEG_VERSION=2.2.1
download http://ffmpeg.zeranoe.com/builds/win32/dev/ffmpeg-$FFMPEG_VERSION-win32-dev.7z ffmpeg-$FFMPEG_VERSION-win32-dev.7z
download http://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-$FFMPEG_VERSION-win64-dev.7z ffmpeg-$FFMPEG_VERSION-win64-dev.7z
download http://ffmpeg.zeranoe.com/builds/win32/shared/ffmpeg-$FFMPEG_VERSION-win32-shared.7z ffmpeg-$FFMPEG_VERSION-win32-shared.7z
@mekya
mekya / GoProStreamer.java
Created January 30, 2015 04:19
GoPro Hero4 Silver - Live Preview on PC (java, ffplay, ffmpeg)
import java.io.IOException;
import java.io.InputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.net.URL;
import java.util.Locale;
@mekya
mekya / Amazon_S3_Bean_Definition.xml
Last active August 4, 2017 13:16
Amazon S3 Bean Definition
<bean id="app.storageClient" class="io.antmedia.storage.AmazonS3StorageClient">
<property name="accessKey" value="Enter your S3_ACCESS_KEY" />
<property name="secretKey" value="Enter your S3_SECRET_KEY" />
<property name="region" value="Enter your REGION_NAME e.g. eu-central-1" />
<property name="storageName" value="Enter your BUCKET_NAME" />
</bean>
@mekya
mekya / HttpForwardFilter.java
Last active August 4, 2017 13:24
Http forward filter For S3
public class HttpForwardFilter implements javax.servlet.Filter {
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
String requestURI = ((HttpServletRequest)request).getRequestURI();
@mekya
mekya / MongoDB_and_Rest_Service.xml
Created August 4, 2017 13:39
MongoDB and Rest Service Integration
<context:component-scan base-package="io.antmedia.rest" />
<bean id="db.datastore" class="io.antmedia.datastore.db.MongoStore">
<constructor-arg value="${webapp.dbName}" />
</bean>
<bean id="web.handler" class="Enter your web handler class that inherits from AntMediaApplicationAdapter" >
<property name="dataStore" ref="db.datastore" />
</bean>
@mekya
mekya / Publish_Social_Endpoints_Configuration.xml
Last active August 4, 2017 14:57
Spring configuration file to publish live stream to social end points
<bean id="preference.store" class="io.antmedia.datastore.preference.PreferenceStore">
<constructor-arg value="/WEB-INF/red5-web.properties" />
</bean>
<bean id="web.handler" class="io.antmedia.serverapp.pscp.Application" >
<property name="videoServiceEndpoints">
<list>
<bean class="io.antmedia.enterprise.social.endpoint.FacebookEndpoint" init-method="start">
<constructor-arg value="Enter Facebook client id"/>
<constructor-arg value="Enter Facebook client secret"/>
<constructor-arg ref="preference.store"/>
@mekya
mekya / draco_build.md
Last active November 16, 2017 12:21
How to Build Draco 1.2.1 For Android with gnustl - Using with PCL

Draco 1.2.1 release

Edit src/draco/core/options.h

Add below function to Options class

  #include <sstream>
  
  ...
  
@mekya
mekya / install_ant-media-server.sh
Last active August 7, 2021 06:12
Install Ant Media Server on Ubuntu 16.04 OpenJDK
#!/bin/bash
#
# Download latest ant media server and run this script by giving the zip file
# ./install_ant-media-server.sh ant-media-server-*.zip
#
if [ -z "$1" ]; then
echo "Please give the Ant Media Server zip file as parameter"
echo "$0 ant-media-server-....zip"