├── .gitignore ├── README.md ├── h-l-s-convertor ├── .gitignore ├── CMakeLists.txt ├── config.h.cmake ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── docs │ ├── h-l-s-convertor-dev.install │ ├── h-l-s-convertor.install │ ├── rules │ └── source │ │ └── format └── src │ ├── CMakeLists.txt │ ├── config.h │ ├── gst-plugins │ ├── CMakeLists.txt │ ├── gsthlsconvertor.cpp │ ├── gsthlsconvertor.h │ └── hlsconvertor.c │ ├── js │ ├── .gitignore │ ├── .npmignore │ ├── Gruntfile.js │ ├── README.md │ ├── README_bower.md │ ├── lib │ │ ├── HLSConvertor.js │ │ ├── browser.js │ │ ├── external.js │ │ └── index.js │ ├── package.json │ └── src │ │ └── hlsconvertor.kmd.json │ ├── js_project_name │ └── server │ ├── CMakeLists.txt │ ├── implementation │ └── objects │ │ ├── HLSConvertorImpl.cpp │ │ └── HLSConvertorImpl.hpp │ └── interface │ ├── hlsconvertor.HLSConvertor.kmd.json │ └── hlsconvertor.kmd.json └── kurento-one2many-call ├── README.md ├── keys ├── README.md ├── server.crt ├── server.csr └── server.key ├── package.json ├── server.js └── static ├── bower.json ├── css └── kurento.css ├── img ├── kurento.png ├── naevatec.png ├── pipeline.png ├── spinner.gif ├── transparent-1px.png ├── urjc.gif └── webrtc.png ├── index.html └── js └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeFiles 3 | Makefile 4 | cmake_install.cmake 5 | install_manifest.txt 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Install Vagrant and load Ubuntu virutal OS 2 | ============ 3 | 4 | See: 5 | [vagrant](https://www.vagrantup.com/downloads.html) 6 | [boxes trusty64](https://atlas.hashicorp.com/ubuntu/boxes/trusty64) 7 | ``` 8 | # virtual port to Ubuntu, using virtual box. 9 | vagrant init ubuntu/trusty64; vagrant up --provider virtualbox 10 | 11 | # make sure the virtual machine's memory is above 1GB 12 | # make sure the virtual machine using bridge mode by commenting out the line in ~/Vagrantfile: 13 | # config.vm.network "public_network" 14 | vagrant ssh 15 | ``` 16 | 17 | Install kurento-media-server, node.js 18 | ============ 19 | ``` 20 | # Install kurento-media-server on the Ubuntu virtual OS: (user:vagrant paw:vagrant) 21 | echo "deb http://ubuntu.kurento.org trusty-dev kms6" | sudo tee /etc/apt/sources.list.d/kurento-dev.list 22 | wget -O - http://ubuntu.kurento.org/kurento.gpg.key | sudo apt-key add - 23 | sudo apt-get update 24 | sudo apt-get install -y kurento-media-server-6.0-dev 25 | sudo apt-get install -y build-essential libtool autotools-dev automake indent astyle git 26 | sudo apt-get install -y libboost-all-dev libjson-glib-dev bison flex uuid-dev libsoup2.4-dev 27 | 28 | sudo service kurento-media-server-6.0 start 29 | 30 | curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - 31 | sudo apt-get install -y nodejs 32 | sudo npm install npm -g 33 | 34 | npm install 35 | npm start 36 | ``` 37 | 38 | 39 | Building and installing HLS Convertor 40 | ===================================== 41 | ``` 42 | cd HLSConvertor/h-l-s-convertor 43 | mkdir .build 44 | cd .build 45 | cmake .. -DGENERATE_JS_CLIENT_PROJECT=TRUE 46 | make 47 | 48 | # copy the generated so file to system's lib folder. 49 | sudo cp ./src/server/*.so /usr/lib/x86_64-linux-gnu/gstreamer-1.5/ 50 | sudo cp ./src/gst-plugins/*.so /usr/lib/x86_64-linux-gnu/kurento/modules/ 51 | 52 | # copy the generated js code to current project. 53 | cp -r ./js ../../kurento-one2many-call/node_modules/kurento-client/node_modules/kurento-module-hlsconvertor/ 54 | vi ../../kurento-one2many-call/node_modules/kurento-client/lib/index.js 55 | # (Add one line) 56 | register('kurento-module-hlsconvertor') 57 | ``` 58 | 59 | 60 | cd node_modules/kurento-client/ 61 | vi lib/index.js 62 | (Add one line) 63 | register('kurento-module-hlsconvertor') 64 | 65 | ********************************** 66 | * building kurento media server 67 | ********************************** 68 | See: https://www.kurento.org/docs/6.0.0/mastering/develop_kurento_modules.html 69 | On Ubuntu virtual box: 70 | sudo apt-get update 71 | sudo apt-get install git 72 | git config --global user.name "rentao" 73 | git config --global user.email "tao@swarmnyc.com" 74 | 75 | sudo apt-get install kurento-media-server-6.0-dev 76 | kurento-module-scaffold.sh HLSConvertor ./HLSConvertor/ 77 | 78 | 79 | cd HLSConvertor/h-l-s-convertor/src 80 | cmake .. 81 | make 82 | 83 | cmake .. -DGENERATE_JS_CLIENT_PROJECT=TRUE 84 | (to generate the js code used by npm[node.js]) 85 | 86 | vi /etc/default/kurento-media-server-6.0 87 | (Add below 2 lines) 88 | export KURENTO_MODULES_PATH=/home/vagrant/swarmnyc/HLSConvertor/h-l-s-convertor/src/src 89 | export GST_PLUGIN_PATH=/home/vagrant/swarmnyc/HLSConvertor/h-l-s-convertor/src/src 90 | sudo service kurento-media-server-6.0 restart 91 | 92 | 93 | 94 | ***************************************** 95 | * test kurento media server by node.js 96 | ***************************************** 97 | Download the tutorial project of kurento from: 98 | https://github.com/Kurento/kurento-tutorial-node 99 | 100 | Suppose we are using the kurento-hello-world to test: 101 | cd kurento-tutorial-node/kurento-hello-world/ 102 | cd node_modules/kurento-client/ 103 | vi lib/index.js 104 | (Add one line) 105 | register('kurento-module-hlsconvertor') 106 | # copy the generated js code to current project. 107 | cp -r /home/vagrant/swarmnyc/HLSConvertor/h-l-s-convertor/src/js/ ./node_modules/kurento-module-hlsconvertor/ 108 | vi package.json 109 | (Add one line in the "dependencies" block) 110 | "kurento-module-hlsconvertor": "0.0.1-dev", 111 | # run the backend server. 112 | cd ../.. 113 | vi server.js 114 | (Change the line, the actual ip address of the running kurento media server) 115 | ws_uri: 'ws://192.168.17.197:8888/kurento' 116 | 117 | (Add below code where webRtcEndpoint is created) 118 | pipeline.create('HLSConvertor', function(error, hlsconvertor) { 119 | console.log("-------------------------creating HLSConvertor-------------------------\n"+webRtcEndpoint); 120 | webRtcEndpoint.connect(hlsconvertor); 121 | console.log("-------------------------creating HLSConvertor finished!-------------------------"); 122 | }); 123 | node server.js 124 | 125 | 126 | 127 | ****************************************** 128 | * Install nvm and nodejs if necessary 129 | ****************************************** 130 | Install nvm to upgrade nodejs from: https://github.com/creationix/nvm 131 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash 132 | . ~/.nvm/nvm.sh 133 | nvm install 0.12.7 134 | 135 | -------------------------------------------------------------------------------- /h-l-s-convertor/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | debian/h_l_s_convertor 3 | -------------------------------------------------------------------------------- /h-l-s-convertor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project ("h-l-s-convertor") 4 | 5 | message ("If KurentoHelpers is not found, then it is necessary to install 6 | kms-cmake-utils package from the kurento repository") 7 | 8 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") 9 | find_package(KurentoHelpers REQUIRED) 10 | 11 | include (KurentoGitHelpers) 12 | message ("If CodeGenerator is not found, then it is necessary to install 13 | kms-core package from the kurento repository") 14 | include (CodeGenerator) 15 | 16 | get_values_from_model(PREFIX VALUE MODELS ${CMAKE_SOURCE_DIR}/src/server/interface KEYS version) 17 | 18 | get_git_version (PROJECT_VERSION ${VALUE_VERSION}) 19 | 20 | string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION}) 21 | list(GET VERSION_LIST 0 PROJECT_VERSION_MAJOR) 22 | list (LENGTH VERSION_LIST _len) 23 | if (${_len} GREATER 1) 24 | list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR) 25 | endif () 26 | if (${_len} GREATER 2) 27 | list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH) 28 | endif () 29 | 30 | find_package(PkgConfig) 31 | 32 | set (GST_REQUIRED 1.5.0) 33 | set (GLIB_REQUIRED 2.38) 34 | set (OPENCV_REQUIRED 2.0.0) 35 | 36 | #gst-plugins dependencies 37 | pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.5>=${GST_REQUIRED}) 38 | pkg_check_modules(GSTREAMER_BASE REQUIRED gstreamer-base-1.5>=${GST_REQUIRED}) 39 | pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.5>=${GST_REQUIRED}) 40 | pkg_check_modules(GSTREAMER_CHECK REQUIRED gstreamer-check-1.5>=${GST_REQUIRED}) 41 | pkg_check_modules(KMSCORE REQUIRED kmscore) 42 | pkg_check_modules(OPENCV REQUIRED opencv>=${OPENCV_REQUIRED}) 43 | 44 | set (VERSION ${PROJECT_VERSION}) 45 | set (PACKAGE ${PROJECT_NAME}) 46 | set (GETTEXT_PACKAGE "h-l-s-convertor") 47 | 48 | include(GNUInstallDirs) 49 | 50 | set (CMAKE_INSTALL_GST_PLUGINS_DIR ${CMAKE_INSTALL_LIBDIR}/gstreamer-1.5) 51 | set (KURENTO_MODULES_SO_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${KURENTO_MODULES_DIR_INSTALL_PREFIX}) 52 | 53 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) 54 | 55 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -DHAVE_CONFIG_H -Werror -Wall") 56 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DHAVE_CONFIG_H -Wall -Werror -std=c++11") 57 | 58 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 59 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 60 | 61 | message(STATUS "Compiling : ${PROJECT_NAME}-${PROJECT_VERSION}") 62 | 63 | add_subdirectory (src) 64 | -------------------------------------------------------------------------------- /h-l-s-convertor/config.h.cmake: -------------------------------------------------------------------------------- 1 | #ifndef __H_L_S_CONVERTOR_CONFIG_H__ 2 | #define __H_L_S_CONVERTOR_CONFIG_H__ 3 | 4 | /* Version */ 5 | #cmakedefine VERSION "@VERSION@" 6 | 7 | /* Package name */ 8 | #cmakedefine PACKAGE "@PACKAGE@" 9 | 10 | /* The gettext domain name */ 11 | #cmakedefine GETTEXT_PACKAGE "@GETTEXT_PACKAGE@" 12 | 13 | /* Library installation directory */ 14 | #cmakedefine KURENTO_MODULES_SO_DIR "@KURENTO_MODULES_SO_DIR@" 15 | 16 | #endif /* __H_L_S_CONVERTOR_CONFIG_H__ */ 17 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/changelog: -------------------------------------------------------------------------------- 1 | h-l-s-convertor (0.0.1~rc1) testing; urgency=medium 2 | 3 | * Initial release. 4 | 5 | -- Maintainer name Tue, 29 Sep 2015 22:11:39 +0000 6 | 7 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/control: -------------------------------------------------------------------------------- 1 | Source: h-l-s-convertor 2 | Section: utils 3 | Priority: optional 4 | Maintainer: Maintainer Name 5 | Build-Depends: debhelper (>= 8.0.0), 6 | cmake, 7 | pkg-config, 8 | kms-core-6.0-dev, 9 | kms-elements-6.0-dev, 10 | kms-filters-6.0-dev, 11 | libopencv-dev 12 | Standards-Version: 3.9.4 13 | 14 | Package: h-l-s-convertor 15 | Architecture: any 16 | Depends: ${shlibs:Depends}, ${misc:Depends}, 17 | Description: package description 18 | 19 | Package: h-l-s-convertor-dev 20 | Architecture: any 21 | Depends: h-l-s-convertor (= ${binary:Version}), 22 | kms-core-6.0-dev, 23 | kms-elements-6.0-dev, 24 | kms-filters-6.0-dev, 25 | libopencv-dev 26 | Description: dev package description 27 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/copyright: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/h-l-s-convertor/debian/copyright -------------------------------------------------------------------------------- /h-l-s-convertor/debian/docs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/h-l-s-convertor/debian/docs -------------------------------------------------------------------------------- /h-l-s-convertor/debian/h-l-s-convertor-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/kurento/modules/*/*.hpp 2 | usr/lib/*/*.so 3 | usr/lib/*/pkgconfig/*.pc 4 | usr/share/kurento/modules/*.kmd.json 5 | usr/share/cmake-*/Modules/* 6 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/h-l-s-convertor.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/lib*.so.* 2 | usr/lib/*/gstreamer-1.5/lib*.so 3 | usr/lib/*/kurento/*/*.so 4 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment this to turn on verbose mode. 5 | #export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ 9 | 10 | override_dh_auto_configure: 11 | dh_auto_configure 12 | -------------------------------------------------------------------------------- /h-l-s-convertor/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(server) 2 | add_subdirectory(gst-plugins) 3 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/config.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_L_S_CONVERTOR_CONFIG_H__ 2 | #define __H_L_S_CONVERTOR_CONFIG_H__ 3 | 4 | /* Version */ 5 | #define VERSION "0.0.1~0.g462adee" 6 | 7 | /* Package name */ 8 | #define PACKAGE "h-l-s-convertor" 9 | 10 | /* The gettext domain name */ 11 | #define GETTEXT_PACKAGE "h-l-s-convertor" 12 | 13 | /* Library installation directory */ 14 | #define KURENTO_MODULES_SO_DIR "/usr/local/lib/x86_64-linux-gnu/kurento/modules" 15 | 16 | #endif /* __H_L_S_CONVERTOR_CONFIG_H__ */ 17 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/gst-plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${GSTREAMER_INCLUDE_DIRS} 3 | ${GSTREAMER_VIDEO_INCLUDE_DIRS} 4 | ${CMAKE_CURRENT_SOURCE_DIR} 5 | ${OPENCV_INCLUDE_DIRS} 6 | ) 7 | 8 | set(H_L_S_CONVERTOR_SOURCES 9 | hlsconvertor.c 10 | gsthlsconvertor.cpp 11 | gsthlsconvertor.h 12 | ) 13 | 14 | add_library(hlsconvertor MODULE ${H_L_S_CONVERTOR_SOURCES}) 15 | 16 | target_link_libraries(hlsconvertor 17 | ${GSTREAMER_LIBRARIES} 18 | ${GSTREAMER_VIDEO_LIBRARIES} 19 | ${OPENCV_LIBRARIES} 20 | ) 21 | 22 | install( 23 | TARGETS hlsconvertor 24 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 25 | LIBRARY DESTINATION ${CMAKE_INSTALL_GST_PLUGINS_DIR} 26 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 27 | ) 28 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/gst-plugins/gsthlsconvertor.cpp: -------------------------------------------------------------------------------- 1 | #include "gsthlsconvertor.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace cv; 13 | using namespace std; 14 | 15 | 16 | GST_DEBUG_CATEGORY_STATIC (gst_h_l_s_convertor_debug_category); 17 | #define GST_CAT_DEFAULT gst_h_l_s_convertor_debug_category 18 | #define PLUGIN_NAME "hlsconvertor" 19 | 20 | #define GST_H_L_S_CONVERTOR_GET_PRIVATE(obj) ( \ 21 | G_TYPE_INSTANCE_GET_PRIVATE ( \ 22 | (obj), \ 23 | GST_TYPE_H_L_S_CONVERTOR, \ 24 | GstHLSConvertorPrivate \ 25 | ) \ 26 | ) 27 | 28 | /* pad templates */ 29 | 30 | #define VIDEO_SRC_CAPS \ 31 | GST_VIDEO_CAPS_MAKE("{ BGRA }") 32 | 33 | #define VIDEO_SINK_CAPS \ 34 | GST_VIDEO_CAPS_MAKE("{ BGRA }") 35 | 36 | /* class initialization */ 37 | 38 | G_DEFINE_TYPE_WITH_CODE (GstHLSConvertor, gst_h_l_s_convertor, 39 | GST_TYPE_VIDEO_FILTER, 40 | GST_DEBUG_CATEGORY_INIT (gst_h_l_s_convertor_debug_category, 41 | PLUGIN_NAME, 0, 42 | "debug category for h_l_s_convertor element") ); 43 | 44 | 45 | static GstFlowReturn 46 | gst_h_l_s_convertor_transform_frame_ip (GstVideoFilter *filter, 47 | GstVideoFrame *frame) 48 | { 49 | static int id = 0; 50 | char filename[256]; 51 | sprintf(filename, "/var/log/kurento-media-server/snapshot%04d.jpg", id++); 52 | int writable = gst_buffer_is_writable(frame->buffer); 53 | GST_ERROR("%d x %d, writable=%d", frame->info.width, frame->info.height, writable); 54 | GstMapInfo map; 55 | 56 | Mat mat(480, 640, CV_8UC4); 57 | vector compression_params; 58 | compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION); 59 | compression_params.push_back(9); 60 | 61 | if (gst_buffer_map (frame->buffer, &map, GST_MAP_WRITE)) { 62 | GST_ERROR("%x size=%lu",map.data[0], map.size); 63 | Mat* snapshot = new Mat (frame->info.height, frame->info.width, CV_8UC4, map.data); 64 | imwrite(filename, *snapshot, compression_params); 65 | /* 66 | for (int i = 0; i<=640*30*4; i++) { 67 | map.data[i] = i % 255; 68 | } 69 | */ 70 | gst_buffer_unmap (frame->buffer, &map); 71 | } 72 | return GST_FLOW_OK; 73 | } 74 | 75 | static void 76 | gst_h_l_s_convertor_finalize (GObject *object) 77 | { 78 | GST_ERROR_OBJECT(object, "@rentao"); 79 | } 80 | 81 | static void 82 | gst_h_l_s_convertor_init (GstHLSConvertor * 83 | h_l_s_convertor) 84 | { 85 | GST_ERROR_OBJECT(h_l_s_convertor, "@rentao"); 86 | } 87 | 88 | static void 89 | gst_h_l_s_convertor_class_init (GstHLSConvertorClass *klass) 90 | { 91 | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); 92 | GstVideoFilterClass *video_filter_class = GST_VIDEO_FILTER_CLASS (klass); 93 | 94 | GST_ERROR_OBJECT(video_filter_class, "@rentao"); 95 | GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, PLUGIN_NAME, 0, PLUGIN_NAME); 96 | 97 | gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), 98 | gst_pad_template_new ("src", GST_PAD_SRC, 99 | GST_PAD_ALWAYS, 100 | gst_caps_from_string (VIDEO_SRC_CAPS) ) ); 101 | gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), 102 | gst_pad_template_new ("sink", GST_PAD_SINK, 103 | GST_PAD_ALWAYS, 104 | gst_caps_from_string (VIDEO_SINK_CAPS) ) ); 105 | 106 | gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass), 107 | "element definition", "Video/Filter", 108 | "Filter doc", 109 | "Developer"); 110 | 111 | gobject_class->finalize = gst_h_l_s_convertor_finalize; 112 | 113 | video_filter_class->transform_frame_ip = 114 | GST_DEBUG_FUNCPTR (gst_h_l_s_convertor_transform_frame_ip); 115 | } 116 | 117 | gboolean 118 | gst_h_l_s_convertor_plugin_init (GstPlugin *plugin) 119 | { 120 | GST_ERROR_OBJECT(plugin, "@rentao"); 121 | return gst_element_register (plugin, PLUGIN_NAME, GST_RANK_NONE, 122 | GST_TYPE_H_L_S_CONVERTOR); 123 | } 124 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/gst-plugins/gsthlsconvertor.h: -------------------------------------------------------------------------------- 1 | #ifndef _GST_H_L_S_CONVERTOR_H_ 2 | #define _GST_H_L_S_CONVERTOR_H_ 3 | 4 | #include 5 | 6 | G_BEGIN_DECLS 7 | #define GST_TYPE_H_L_S_CONVERTOR (gst_h_l_s_convertor_get_type()) 8 | #define GST_H_L_S_CONVERTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_H_L_S_CONVERTOR,GstHLSConvertor)) 9 | #define GST_H_L_S_CONVERTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_H_L_S_CONVERTOR,GstHLSConvertorClass)) 10 | #define GST_IS_H_L_S_CONVERTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_H_L_S_CONVERTOR)) 11 | #define GST_IS_H_L_S_CONVERTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_H_L_S_CONVERTOR)) 12 | typedef struct _GstHLSConvertor GstHLSConvertor; 13 | typedef struct _GstHLSConvertorClass GstHLSConvertorClass; 14 | typedef struct _GstHLSConvertorPrivate GstHLSConvertorPrivate; 15 | 16 | struct _GstHLSConvertor 17 | { 18 | GstVideoFilter base; 19 | GstHLSConvertorPrivate *priv; 20 | }; 21 | 22 | struct _GstHLSConvertorClass 23 | { 24 | GstVideoFilterClass base_h_l_s_convertor_class; 25 | }; 26 | 27 | GType gst_h_l_s_convertor_get_type (void); 28 | 29 | gboolean gst_h_l_s_convertor_plugin_init (GstPlugin * plugin); 30 | 31 | G_END_DECLS 32 | #endif /* _GST_H_L_S_CONVERTOR_H_ */ 33 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/gst-plugins/hlsconvertor.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "gsthlsconvertor.h" 5 | 6 | static gboolean 7 | init (GstPlugin * plugin) 8 | { 9 | GST_ERROR("@rentao"); 10 | GST_ERROR_OBJECT(plugin, "@rentao"); 11 | if (!gst_h_l_s_convertor_plugin_init (plugin)) 12 | return FALSE; 13 | 14 | return TRUE; 15 | } 16 | 17 | GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, 18 | GST_VERSION_MINOR, 19 | hlsconvertor, 20 | "Filter documentation", 21 | init, VERSION, GST_LICENSE_UNKNOWN, "PACKAGE_NAME", "origin") 22 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/.gitignore: -------------------------------------------------------------------------------- 1 | doc/ 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/.npmignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | doc/ 3 | bower.json 4 | Gruntfile.js 5 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2014-2015 Kurento (http://kurento.org/) 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the GNU Lesser General Public License 6 | * (LGPL) version 2.1 which accompanies this distribution, and is available at 7 | * http://www.gnu.org/licenses/lgpl-2.1.html 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | */ 15 | 16 | 17 | module.exports = function(grunt) 18 | { 19 | var DIST_DIR = 'dist'; 20 | 21 | var pkg = grunt.file.readJSON('package.json'); 22 | 23 | const PKG_BROWSER = 'lib/browser.js'; 24 | 25 | // Project configuration. 26 | grunt.initConfig({ 27 | pkg: pkg, 28 | 29 | // Plugins configuration 30 | clean: 31 | { 32 | 'doc': '<%= jsdoc.all.dest %>', 33 | 'browser': DIST_DIR 34 | }, 35 | 36 | // Generate documentation 37 | jsdoc: 38 | { 39 | all: 40 | { 41 | src: [ 42 | 'README.md', 43 | 'lib/**/*.js', 44 | 'test/*.js' 45 | ], 46 | dest: 'doc/jsdoc' 47 | } 48 | }, 49 | 50 | // Generate browser versions and mapping debug file 51 | browserify: 52 | { 53 | options: { 54 | alias: ['.:<%= pkg.name %>'], 55 | external: [ 56 | 'es6-promise', 57 | 'inherits', 58 | 'kurento-client', 59 | 'promisecallback' 60 | ] 61 | }, 62 | 63 | 'standard': 64 | { 65 | src: PKG_BROWSER, 66 | dest: DIST_DIR+'/<%= pkg.name %>.js' 67 | }, 68 | 69 | 'minified': 70 | { 71 | src: PKG_BROWSER, 72 | dest: DIST_DIR+'/<%= pkg.name %>.min.js', 73 | 74 | options: 75 | { 76 | browserifyOptions: { 77 | debug: true 78 | }, 79 | plugin: [ 80 | ['minifyify', 81 | { 82 | compressPath: DIST_DIR, 83 | map: '<%= pkg.name %>.map', 84 | output: DIST_DIR+'/<%= pkg.name %>.map' 85 | }] 86 | ] 87 | } 88 | } 89 | }, 90 | 91 | // Generate bower.json file from package.json data 92 | sync: 93 | { 94 | bower: 95 | { 96 | options: 97 | { 98 | sync: [ 99 | 'name', 'description', 'license', 'keywords', 'homepage', 100 | 'repository' 101 | ], 102 | overrides: { 103 | authors: (pkg.author ? [pkg.author] : []).concat(pkg.contributors || []), 104 | ignore: ['doc/', 'lib/', 'Gruntfile.js', 'package.json'], 105 | main: DIST_DIR+'/<%= pkg.name %>.js' 106 | } 107 | } 108 | } 109 | } }); 110 | 111 | // Load plugins 112 | grunt.loadNpmTasks('grunt-browserify'); 113 | grunt.loadNpmTasks('grunt-contrib-clean'); 114 | grunt.loadNpmTasks('grunt-jsdoc'); 115 | grunt.loadNpmTasks('grunt-npm2bower-sync'); 116 | 117 | // Alias tasks 118 | grunt.registerTask('default', ['clean', 'jsdoc', 'browserify', 'sync:bower']); 119 | }; 120 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/README.md: -------------------------------------------------------------------------------- 1 | [![][KurentoImage]][Kurento] 2 | 3 | Copyright ? 2013-2016 [Kurento]. Licensed under [LGPL v2.1 License]. 4 | 5 | kurento-module-hlsconvertor-js 6 | =============== 7 | 8 | This repository host the auto-generated JavaScript client for [Kurento] module "hlsconvertor". 9 | 10 | Module "hlsconvertor" description: 11 | 12 | What is Kurento 13 | --------------- 14 | 15 | Kurento is an open source software project providing a platform suitable 16 | for creating modular applications with advanced real-time communication 17 | capabilities. For knowing more about Kurento, please visit the Kurento 18 | project website: http://www.kurento.org. 19 | 20 | Kurento is part of [FIWARE]. For further information on the relationship of 21 | FIWARE and Kurento check the [Kurento FIWARE Catalog Entry] 22 | 23 | Kurento is part of the [NUBOMEDIA] research initiative. 24 | 25 | Documentation 26 | ------------- 27 | 28 | The Kurento project provides detailed [documentation] including tutorials, 29 | installation and development guides. A simplified version of the documentation 30 | can be found on [readthedocs.org]. The [Open API specification] a.k.a. Kurento 31 | Protocol is also available on [apiary.io]. 32 | 33 | Source 34 | ------ 35 | 36 | Code for other Kurento projects can be found in the [GitHub Kurento Group]. 37 | 38 | News and Website 39 | ---------------- 40 | 41 | Check the [Kurento blog] 42 | Follow us on Twitter @[kurentoms]. 43 | 44 | Issue tracker 45 | ------------- 46 | 47 | Issues and bug reports should be posted to the [GitHub Kurento bugtracker] 48 | 49 | Licensing and distribution 50 | -------------------------- 51 | 52 | Software associated to Kurento is provided as open source under GNU Library or 53 | "Lesser" General Public License, version 2.1 (LGPL-2.1). Please check the 54 | specific terms and conditions linked to this open source license at 55 | http://opensource.org/licenses/LGPL-2.1. Please note that software derived as a 56 | result of modifying the source code of Kurento software in order to fix a bug 57 | or incorporate enhancements is considered a derivative work of the product. 58 | Software that merely uses or aggregates (i.e. links to) an otherwise unmodified 59 | version of existing software is not considered a derivative work. 60 | 61 | Contribution policy 62 | ------------------- 63 | 64 | You can contribute to the Kurento community through bug-reports, bug-fixes, new 65 | code or new documentation. For contributing to the Kurento community, drop a 66 | post to the [Kurento Public Mailing List] providing full information about your 67 | contribution and its value. In your contributions, you must comply with the 68 | following guidelines 69 | 70 | * You must specify the specific contents of your contribution either through a 71 | detailed bug description, through a pull-request or through a patch. 72 | * You must specify the licensing restrictions of the code you contribute. 73 | * For newly created code to be incorporated in the Kurento code-base, you must 74 | accept Kurento to own the code copyright, so that its open source nature is 75 | guaranteed. 76 | * You must justify appropriately the need and value of your contribution. The 77 | Kurento project has no obligations in relation to accepting contributions 78 | from third parties. 79 | * The Kurento project leaders have the right of asking for further 80 | explanations, tests or validations of any code contributed to the community 81 | before it being incorporated into the Kurento code-base. You must be ready to 82 | addressing all these kind of concerns before having your code approved. 83 | 84 | Support 85 | ------- 86 | 87 | The Kurento project provides community support through the [Kurento Public 88 | Mailing List] and through [StackOverflow] using the tags *kurento* and 89 | *fiware-kurento*. 90 | 91 | Before asking for support, please read first the [Kurento Netiquette Guidelines] 92 | 93 | [documentation]: http://www.kurento.org/documentation 94 | [FIWARE]: http://www.fiware.org 95 | [GitHub Kurento bugtracker]: https://github.com/Kurento/bugtracker/issues 96 | [GitHub Kurento Group]: https://github.com/kurento 97 | [kurentoms]: http://twitter.com/kurentoms 98 | [Kurento]: http://kurento.org 99 | [Kurento Blog]: http://www.kurento.org/blog 100 | [Kurento FIWARE Catalog Entry]: http://catalogue.fiware.org/enablers/stream-oriented-kurento 101 | [Kurento Netiquette Guidelines]: http://www.kurento.org/blog/kurento-netiquette-guidelines 102 | [Kurento Public Mailing list]: https://groups.google.com/forum/#!forum/kurento 103 | [KurentoImage]: https://secure.gravatar.com/avatar/21a2a12c56b2a91c8918d5779f1778bf?s=120 104 | [LGPL v2.1 License]: http://www.gnu.org/licenses/lgpl-2.1.html 105 | [NUBOMEDIA]: http://www.nubomedia.eu 106 | [StackOverflow]: http://stackoverflow.com/search?q=kurento 107 | [readthedocs.org]: http://kurento.readthedocs.org/ 108 | [Open API specification]: http://kurento.github.io/doc-kurento/ 109 | [apiary.io]: http://docs.streamoriented.apiary.io/ 110 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/README_bower.md: -------------------------------------------------------------------------------- 1 | [![][KurentoImage]][Kurento] 2 | 3 | Copyright ? 2013-2016 [Kurento]. Licensed under [LGPL v2.1 License]. 4 | 5 | kurento-module-hlsconvertor-bower 6 | =============== 7 | 8 | This repository host the auto-generated JavaScript client for [Kurento] 9 | module "hlsconvertor" to be published in [Bower]. 10 | 11 | Module "hlsconvertor" description: 12 | 13 | What is Kurento 14 | --------------- 15 | 16 | Kurento is an open source software project providing a platform suitable 17 | for creating modular applications with advanced real-time communication 18 | capabilities. For knowing more about Kurento, please visit the Kurento 19 | project website: http://www.kurento.org. 20 | 21 | Kurento is part of [FIWARE]. For further information on the relationship of 22 | FIWARE and Kurento check the [Kurento FIWARE Catalog Entry] 23 | 24 | Kurento is part of the [NUBOMEDIA] research initiative. 25 | 26 | Documentation 27 | ------------- 28 | 29 | The Kurento project provides detailed [documentation] including tutorials, 30 | installation and development guides. A simplified version of the documentation 31 | can be found on [readthedocs.org]. The [Open API specification] a.k.a. Kurento 32 | Protocol is also available on [apiary.io]. 33 | 34 | Source 35 | ------ 36 | 37 | Code for other Kurento projects can be found in the [GitHub Kurento Group]. 38 | 39 | News and Website 40 | ---------------- 41 | 42 | Check the [Kurento blog] 43 | Follow us on Twitter @[kurentoms]. 44 | 45 | Issue tracker 46 | ------------- 47 | 48 | Issues and bug reports should be posted to the [GitHub Kurento bugtracker] 49 | 50 | Licensing and distribution 51 | -------------------------- 52 | 53 | Software associated to Kurento is provided as open source under GNU Library or 54 | "Lesser" General Public License, version 2.1 (LGPL-2.1). Please check the 55 | specific terms and conditions linked to this open source license at 56 | http://opensource.org/licenses/LGPL-2.1. Please note that software derived as a 57 | result of modifying the source code of Kurento software in order to fix a bug 58 | or incorporate enhancements is considered a derivative work of the product. 59 | Software that merely uses or aggregates (i.e. links to) an otherwise unmodified 60 | version of existing software is not considered a derivative work. 61 | 62 | Contribution policy 63 | ------------------- 64 | 65 | You can contribute to the Kurento community through bug-reports, bug-fixes, new 66 | code or new documentation. For contributing to the Kurento community, drop a 67 | post to the [Kurento Public Mailing List] providing full information about your 68 | contribution and its value. In your contributions, you must comply with the 69 | following guidelines 70 | 71 | * You must specify the specific contents of your contribution either through a 72 | detailed bug description, through a pull-request or through a patch. 73 | * You must specify the licensing restrictions of the code you contribute. 74 | * For newly created code to be incorporated in the Kurento code-base, you must 75 | accept Kurento to own the code copyright, so that its open source nature is 76 | guaranteed. 77 | * You must justify appropriately the need and value of your contribution. The 78 | Kurento project has no obligations in relation to accepting contributions 79 | from third parties. 80 | * The Kurento project leaders have the right of asking for further 81 | explanations, tests or validations of any code contributed to the community 82 | before it being incorporated into the Kurento code-base. You must be ready to 83 | addressing all these kind of concerns before having your code approved. 84 | 85 | Support 86 | ------- 87 | 88 | The Kurento project provides community support through the [Kurento Public 89 | Mailing List] and through [StackOverflow] using the tags *kurento* and 90 | *fiware-kurento*. 91 | 92 | Before asking for support, please read first the [Kurento Netiquette Guidelines] 93 | 94 | [documentation]: http://www.kurento.org/documentation 95 | [FIWARE]: http://www.fiware.org 96 | [GitHub Kurento bugtracker]: https://github.com/Kurento/bugtracker/issues 97 | [GitHub Kurento Group]: https://github.com/kurento 98 | [kurentoms]: http://twitter.com/kurentoms 99 | [Kurento]: http://kurento.org 100 | [Kurento Blog]: http://www.kurento.org/blog 101 | [Kurento FIWARE Catalog Entry]: http://catalogue.fiware.org/enablers/stream-oriented-kurento 102 | [Kurento Netiquette Guidelines]: http://www.kurento.org/blog/kurento-netiquette-guidelines 103 | [Kurento Public Mailing list]: https://groups.google.com/forum/#!forum/kurento 104 | [KurentoImage]: https://secure.gravatar.com/avatar/21a2a12c56b2a91c8918d5779f1778bf?s=120 105 | [LGPL v2.1 License]: http://www.gnu.org/licenses/lgpl-2.1.html 106 | [NUBOMEDIA]: http://www.nubomedia.eu 107 | [StackOverflow]: http://stackoverflow.com/search?q=kurento 108 | [Bower]: http://bower.io/ 109 | [readthedocs.org]: http://kurento.readthedocs.org/ 110 | [Open API specification]: http://kurento.github.io/doc-kurento/ 111 | [apiary.io]: http://docs.streamoriented.apiary.io/ 112 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/lib/HLSConvertor.js: -------------------------------------------------------------------------------- 1 | /* Autogenerated with Kurento Idl */ 2 | 3 | /* 4 | * (C) Copyright 2013-2015 Kurento (http://kurento.org/) 5 | * 6 | * All rights reserved. This program and the accompanying materials are made 7 | * available under the terms of the GNU Lesser General Public License (LGPL) 8 | * version 2.1 which accompanies this distribution, and is available at 9 | * http://www.gnu.org/licenses/lgpl-2.1.html 10 | * 11 | * This library is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 14 | * details. 15 | */ 16 | 17 | var inherits = require('inherits'); 18 | 19 | var kurentoClient = require('kurento-client'); 20 | 21 | var disguise = kurentoClient.disguise; 22 | 23 | var ChecktypeError = kurentoClient.checkType.ChecktypeError; 24 | 25 | var Filter = kurentoClient.register.abstracts.Filter; 26 | 27 | 28 | /** 29 | * Create an element 30 | * 31 | * @classdesc 32 | * HLSConvertor interface. Documentation about the module 33 | * 34 | * @extends module:core/abstracts.Filter 35 | * 36 | * @constructor module:hlsconvertor.HLSConvertor 37 | */ 38 | function HLSConvertor(){ 39 | HLSConvertor.super_.call(this); 40 | }; 41 | inherits(HLSConvertor, Filter); 42 | 43 | 44 | /** 45 | * @alias module:hlsconvertor.HLSConvertor.constructorParams 46 | * 47 | * @property {module:core.MediaPipeline} mediaPipeline 48 | * the parent {@link module:core.MediaPipeline MediaPipeline} 49 | */ 50 | HLSConvertor.constructorParams = { 51 | mediaPipeline: { 52 | type: 'MediaPipeline', 53 | required: true 54 | } 55 | }; 56 | 57 | /** 58 | * @alias module:hlsconvertor.HLSConvertor.events 59 | * 60 | * @extends module:core/abstracts.Filter.events 61 | */ 62 | HLSConvertor.events = Filter.events; 63 | 64 | 65 | /** 66 | * Checker for {@link module:hlsconvertor.HLSConvertor} 67 | * 68 | * @memberof module:hlsconvertor 69 | * 70 | * @param {external:String} key 71 | * @param {module:hlsconvertor.HLSConvertor} value 72 | */ 73 | function checkHLSConvertor(key, value) 74 | { 75 | if(!(value instanceof HLSConvertor)) 76 | throw ChecktypeError(key, HLSConvertor, value); 77 | }; 78 | 79 | 80 | module.exports = HLSConvertor; 81 | 82 | HLSConvertor.check = checkHLSConvertor; 83 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/lib/browser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Loader for the kurento-module-hlsconvertor package on the browser 3 | */ 4 | 5 | require('.'); 6 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/lib/external.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The built-in Boolean object 3 | * @external Boolean 4 | * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean Boolean} 5 | */ 6 | 7 | /** 8 | * The built-in Error object 9 | * @external Error 10 | * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error Error} 11 | */ 12 | 13 | /** 14 | * Integer object (built-in {external:Number} object subtype) 15 | * @external Integer 16 | * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger Integer} 17 | */ 18 | 19 | /** 20 | * The built-in Number object 21 | * @external Number 22 | * @see {@link https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number Number} 23 | */ 24 | 25 | /** 26 | * The built-in Object object 27 | * @external Object 28 | * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object Object} 29 | */ 30 | 31 | /** 32 | * The built-in Promise object 33 | * @external Promise 34 | * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise Promise} 35 | */ 36 | 37 | /** 38 | * The built-in String object 39 | * @external String 40 | * @see {@link https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String String} 41 | */ 42 | 43 | 44 | /** 45 | * Node.js EventEmitter object 46 | * @external EventEmitter 47 | * @see {@link http://nodejs.org/api/events.html#events_class_events_eventemitter EventEmitter} 48 | */ 49 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/lib/index.js: -------------------------------------------------------------------------------- 1 | /* Autogenerated with Kurento Idl */ 2 | 3 | /* 4 | * (C) Copyright 2013-2015 Kurento (http://kurento.org/) 5 | * 6 | * All rights reserved. This program and the accompanying materials are made 7 | * available under the terms of the GNU Lesser General Public License (LGPL) 8 | * version 2.1 which accompanies this distribution, and is available at 9 | * http://www.gnu.org/licenses/lgpl-2.1.html 10 | * 11 | * This library is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 14 | * details. 15 | */ 16 | 17 | /** 18 | * Media API for the Kurento Web SDK 19 | * 20 | * @module hlsconvertor 21 | * 22 | * @copyright 2013-2015 Kurento (http://kurento.org/) 23 | * @license LGPL 24 | */ 25 | 26 | Object.defineProperty(exports, 'name', {value: 'hlsconvertor'}); 27 | Object.defineProperty(exports, 'version', {value: '0.0.1-dev'}); 28 | 29 | 30 | var HLSConvertor = require('./HLSConvertor'); 31 | 32 | 33 | exports.HLSConvertor = HLSConvertor; 34 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kurento-module-hlsconvertor", 3 | "version": "0.0.1-dev", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "prepublish": "grunt" 8 | }, 9 | "dependencies": { 10 | "es6-promise": "^2.0.1", 11 | "inherits": "^2.0.1", 12 | "promisecallback": "^0.0.3" 13 | }, 14 | "devDependencies": { 15 | "bower": "~1.4.1", 16 | "grunt": "~0.4.5", 17 | "grunt-browserify": "^3.6.0", 18 | "grunt-cli": "~0.1.13", 19 | "grunt-contrib-clean": "~0.6.0", 20 | "grunt-jsdoc": "^0.6.3", 21 | "grunt-npm2bower-sync": "^0.9.1", 22 | "minifyify": "^6.4.0" 23 | }, 24 | "keywords": [ 25 | "Kurento", 26 | "module", 27 | "plugin" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js/src/hlsconvertor.kmd.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hlsconvertor", 3 | "version": "0.0.1-dev", 4 | "kurentoVersion": "^6.0.0", 5 | "imports": [ 6 | { 7 | "name": "core", 8 | "version": "^6.0.0", 9 | "mavenVersion": "[6.0.0,7.0.0-SNAPSHOT)", 10 | "npmVersion": ">=6.0.0 <7.0.0" 11 | }, 12 | { 13 | "name": "elements", 14 | "version": "^6.0.0", 15 | "mavenVersion": "[6.0.0,7.0.0-SNAPSHOT)", 16 | "npmVersion": ">=6.0.0 <7.0.0" 17 | }, 18 | { 19 | "name": "filters", 20 | "version": "^6.0.0", 21 | "mavenVersion": "[6.0.0,7.0.0-SNAPSHOT)", 22 | "npmVersion": ">=6.0.0 <7.0.0" 23 | } 24 | ], 25 | "code": { 26 | "api": { 27 | "js": { 28 | "nodeName": "kurento-module-hlsconvertor", 29 | "npmDescription": "", 30 | "npmVersion": "0.0.1" 31 | }, 32 | "java": { 33 | "mavenGroupId": "org.kurento.module", 34 | "packageName": "org.kurento.module.hlsconvertor", 35 | "mavenArtifactId": "hlsconvertor", 36 | "mavenVersion": "0.0.1-SNAPSHOT" 37 | } 38 | }, 39 | "implementation": { 40 | "lib": "libkmshlsconvertor", 41 | "cppNamespace": "kurento::module::hlsconvertor" 42 | } 43 | }, 44 | "remoteClasses": [ 45 | { 46 | "name": "HLSConvertor", 47 | "doc": "HLSConvertor interface. Documentation about the module", 48 | "extends": "Filter", 49 | "constructor": { 50 | "params": [ 51 | { 52 | "name": "mediaPipeline", 53 | "doc": "the parent :rom:cls:`MediaPipeline`", 54 | "type": "MediaPipeline" 55 | } 56 | ], 57 | "doc": "Create an element" 58 | } 59 | } 60 | ], 61 | "complexTypes": [], 62 | "events": [] 63 | } 64 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/js_project_name: -------------------------------------------------------------------------------- 1 | kurento-module-hlsconvertor -------------------------------------------------------------------------------- /h-l-s-convertor/src/server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | 3 | include (CodeGenerator) 4 | 5 | generate_code ( 6 | MODELS ${CMAKE_CURRENT_SOURCE_DIR}/interface 7 | SERVER_STUB_DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/implementation/objects 8 | ) 9 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/server/implementation/objects/HLSConvertorImpl.cpp: -------------------------------------------------------------------------------- 1 | /* Autogenerated with kurento-module-creator */ 2 | 3 | #include 4 | #include "MediaPipeline.hpp" 5 | #include "MediaPipelineImpl.hpp" 6 | #include 7 | #include "HLSConvertorImpl.hpp" 8 | #include 9 | #include 10 | 11 | #define GST_CAT_DEFAULT kurento_hlsconvertor_impl 12 | GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); 13 | #define GST_DEFAULT_NAME "KurentoHLSConvertorImpl" 14 | 15 | namespace kurento 16 | { 17 | namespace module 18 | { 19 | namespace hlsconvertor 20 | { 21 | 22 | HLSConvertorImpl::HLSConvertorImpl (const boost::property_tree::ptree &config, std::shared_ptr mediaPipeline) : FilterImpl (config, std::dynamic_pointer_cast (mediaPipeline)) 23 | { 24 | 25 | std::shared_ptr pipe; 26 | pipe = std::dynamic_pointer_cast (getMediaPipeline() ); 27 | gchar *name; 28 | GstElement* sampleplugin; 29 | // GstCaps *c = NULL; 30 | name = gst_element_get_name(element); 31 | // GST_WARNING_OBJECT(element, "output_object"); 32 | GST_DEBUG ("@rt HLSConvertor Working Here = %s, element name=%s", getName ().c_str (), name); 33 | 34 | g_object_set (element, "filter-factory", "hlsconvertor", NULL); 35 | g_object_get (G_OBJECT (element), "filter", &sampleplugin, NULL); 36 | g_object_get (G_OBJECT(element), "filter-factory", &name, NULL); 37 | GST_DEBUG("@rt filter-factory is %s", name); 38 | int type; 39 | g_object_get (G_OBJECT(element), "type", &type, NULL); 40 | GST_DEBUG("@rt filter-type is %d", type); 41 | if (sampleplugin == NULL) { 42 | GST_DEBUG ("Media Object not avialable"); 43 | throw KurentoException (MEDIA_OBJECT_NOT_AVAILABLE, 44 | "Media Object not available"); 45 | } 46 | 47 | // g_object_unref (sampleplugin); 48 | /* 49 | g_object_get (G_OBJECT (element), "video-caps", c, NULL); 50 | if (c == NULL) { 51 | GST_LOG ("@rt video-caps no available"); 52 | } else { 53 | GST_LOG ("@rt video-caps is %s", gst_caps_to_string(c) ); 54 | } 55 | 56 | if (!GST_IS_ELEMENT (element)) { 57 | GST_DEBUG ("@rt element checking GST_IS_ELEMENT (element) failed."); 58 | } 59 | */ 60 | // GstElement *queue = gst_bin_get_by_name(GST_BIN(element), "queue"); 61 | GstPad* vsPad; 62 | vsPad = gst_element_get_static_pad(element, "src"); 63 | if (vsPad == NULL) { 64 | GST_DEBUG("@rt can not get sink pad from element-bin."); 65 | } 66 | GstElement* sink = gst_bin_get_by_name(GST_BIN(element), "agnosticbin0"); 67 | // GstElement *sink = gst_bin_get_by_name(GST_BIN(element), "sink"); 68 | if (sink == NULL) { 69 | GST_DEBUG("@rt can not get agnosticbin0 from element-bin."); 70 | } else { 71 | gst_element_set_state(sink, GST_STATE_NULL); 72 | 73 | // gst_element_unlink(queue, sink); 74 | // gst_bin_remove(GST_BIN(element), sink); 75 | 76 | g_object_unref(sink); 77 | } 78 | 79 | sink = gst_element_factory_make("filesink", "sink@rt"); 80 | if (sink == NULL) { 81 | GST_DEBUG("@rt can not make filesink element."); 82 | } else { 83 | vsPad = gst_element_get_static_pad(sink, "sink"); 84 | if (vsPad == NULL) { 85 | GST_DEBUG("@rt can not get sink pad from filesink element."); 86 | } 87 | 88 | // gst_element_set_locked_state (element, TRUE); 89 | // gst_element_set_state (element, GST_STATE_NULL); 90 | // gst_bin_remove (GST_BIN ( pipe->getPipeline() ), element); 91 | 92 | // g_object_set(G_OBJECT(sink), "location", "/var/log/kurento-media-server/location", NULL); 93 | g_object_set(G_OBJECT(sink), "append", TRUE, NULL); 94 | // if (!gst_bin_add (GST_BIN ( pipe->getPipeline() ), sampleplugin)) GST_DEBUG("@rt pipeline add element failed.");; 95 | // if (!gst_bin_add (GST_BIN ( pipe->getPipeline() ), sink)) GST_DEBUG("@rt pipeline add sink failed.");; 96 | if (!gst_bin_add (GST_BIN ( element ), sink)) GST_DEBUG("@rt pipeline add sink failed.");; 97 | if (!gst_element_link(sampleplugin, sink)) GST_DEBUG("@rt link element and sink failed."); 98 | // element = sink; 99 | } 100 | //@ gst_bin_add(GST_BIN(element), sink); 101 | 102 | // GstPad* sinkPad; 103 | /* 104 | sinkPad = gst_pad_new("sink_video", GST_PAD_SINK); 105 | gst_element_add_pad(element, sinkPad); 106 | */ 107 | //@ gst_element_sync_state_with_parent(sink); 108 | // gst_element_link(queue, sink); 109 | 110 | //GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(g_pipeline)); 111 | //gst_element_set_bus(sink, bus); 112 | //gst_object_unref(bus); 113 | 114 | // gst_element_set_state(sink, GST_STATE_PLAYING); 115 | // gst_element_set_state(element, GST_STATE_PLAYING); 116 | 117 | // g_object_unref(queue); 118 | /* 119 | sinkPad = gst_element_get_static_pad(element, "sink_video"); 120 | if (sinkPad == NULL) { 121 | GST_DEBUG("@rt can not get static sink_video pad."); 122 | } else { 123 | g_object_get (G_OBJECT (sinkPad), "location", &name, NULL); 124 | GST_DEBUG("@rt sinkPad's location=%s", name); 125 | } 126 | */ 127 | GST_DEBUG ("@rt FileSink init finished."); 128 | 129 | } 130 | 131 | MediaObjectImpl * 132 | HLSConvertorImplFactory::createObject (const boost::property_tree::ptree &config, std::shared_ptr mediaPipeline) const 133 | { 134 | return new HLSConvertorImpl (config, mediaPipeline); 135 | } 136 | 137 | HLSConvertorImpl::StaticConstructor HLSConvertorImpl::staticConstructor; 138 | 139 | HLSConvertorImpl::StaticConstructor::StaticConstructor() 140 | { 141 | GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, GST_DEFAULT_NAME, 0, 142 | GST_DEFAULT_NAME); 143 | } 144 | 145 | } /* hlsconvertor */ 146 | } /* module */ 147 | } /* kurento */ 148 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/server/implementation/objects/HLSConvertorImpl.hpp: -------------------------------------------------------------------------------- 1 | /* Autogenerated with kurento-module-creator */ 2 | 3 | #ifndef __HLSCONVERTOR_IMPL_HPP__ 4 | #define __HLSCONVERTOR_IMPL_HPP__ 5 | 6 | #include "FilterImpl.hpp" 7 | #include "HLSConvertor.hpp" 8 | #include 9 | #include 10 | 11 | namespace kurento 12 | { 13 | namespace module 14 | { 15 | namespace hlsconvertor 16 | { 17 | class HLSConvertorImpl; 18 | } /* hlsconvertor */ 19 | } /* module */ 20 | } /* kurento */ 21 | 22 | namespace kurento 23 | { 24 | void Serialize (std::shared_ptr &object, JsonSerializer &serializer); 25 | } /* kurento */ 26 | 27 | namespace kurento 28 | { 29 | class MediaPipelineImpl; 30 | } /* kurento */ 31 | 32 | namespace kurento 33 | { 34 | namespace module 35 | { 36 | namespace hlsconvertor 37 | { 38 | 39 | class HLSConvertorImpl : public FilterImpl, public virtual HLSConvertor 40 | { 41 | 42 | public: 43 | 44 | HLSConvertorImpl (const boost::property_tree::ptree &config, std::shared_ptr mediaPipeline); 45 | 46 | virtual ~HLSConvertorImpl () {}; 47 | 48 | /* Next methods are automatically implemented by code generator */ 49 | virtual bool connect (const std::string &eventType, std::shared_ptr handler); 50 | virtual void invoke (std::shared_ptr obj, 51 | const std::string &methodName, const Json::Value ¶ms, 52 | Json::Value &response); 53 | 54 | virtual void Serialize (JsonSerializer &serializer); 55 | 56 | private: 57 | 58 | class StaticConstructor 59 | { 60 | public: 61 | StaticConstructor(); 62 | }; 63 | 64 | static StaticConstructor staticConstructor; 65 | 66 | }; 67 | 68 | } /* hlsconvertor */ 69 | } /* module */ 70 | } /* kurento */ 71 | 72 | #endif /* __HLSCONVERTOR_IMPL_HPP__ */ 73 | -------------------------------------------------------------------------------- /h-l-s-convertor/src/server/interface/hlsconvertor.HLSConvertor.kmd.json: -------------------------------------------------------------------------------- 1 | { 2 | "remoteClasses": [ 3 | { 4 | "name": "HLSConvertor", 5 | "extends": "Filter", 6 | "doc": "HLSConvertor interface. Documentation about the module", 7 | "constructor": { 8 | "doc": "Create an element", 9 | "params": [ 10 | { 11 | "name": "mediaPipeline", 12 | "doc": "the parent :rom:cls:`MediaPipeline`", 13 | "type": "MediaPipeline", 14 | "final": true 15 | } 16 | ] 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /h-l-s-convertor/src/server/interface/hlsconvertor.kmd.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hlsconvertor", 3 | "version": "0.0.1-dev", 4 | "kurentoVersion": "^6.0.0" 5 | } 6 | -------------------------------------------------------------------------------- /kurento-one2many-call/README.md: -------------------------------------------------------------------------------- 1 | [![License badge](https://img.shields.io/badge/license-Apache2-orange.svg)](http://www.apache.org/licenses/LICENSE-2.0) 2 | [![Documentation badge](https://readthedocs.org/projects/fiware-orion/badge/?version=latest)](http://doc-kurento.readthedocs.org/en/latest/) 3 | [![Docker badge](https://img.shields.io/docker/pulls/fiware/orion.svg)](https://hub.docker.com/r/fiware/stream-oriented-kurento/) 4 | [![Support badge]( https://img.shields.io/badge/support-sof-yellowgreen.svg)](http://stackoverflow.com/questions/tagged/kurento) 5 | 6 | [![][KurentoImage]][Kurento] 7 | 8 | Copyright © 2013-2016 [Kurento]. Licensed under [Apache 2.0 License]. 9 | 10 | kurento-one2many-call 11 | ===================== 12 | 13 | Kurento Java Tutorial: WebRTC one to many video call. 14 | 15 | Running this tutorial 16 | --------------------- 17 | 18 | In order to run this tutorial, please read the following [instructions]. 19 | 20 | What is Kurento 21 | --------------- 22 | 23 | Kurento is an open source software project providing a platform suitable 24 | for creating modular applications with advanced real-time communication 25 | capabilities. For knowing more about Kurento, please visit the Kurento 26 | project website: http://www.kurento.org. 27 | 28 | Kurento is part of [FIWARE]. For further information on the relationship of 29 | FIWARE and Kurento check the [Kurento FIWARE Catalog Entry] 30 | 31 | Kurento is part of the [NUBOMEDIA] research initiative. 32 | 33 | Documentation 34 | ------------- 35 | 36 | The Kurento project provides detailed [documentation] including tutorials, 37 | installation and development guides. A simplified version of the documentation 38 | can be found on [readthedocs.org]. The [Open API specification] a.k.a. Kurento 39 | Protocol is also available on [apiary.io]. 40 | 41 | Source 42 | ------ 43 | 44 | Code for other Kurento projects can be found in the [GitHub Kurento Group]. 45 | 46 | News and Website 47 | ---------------- 48 | 49 | Check the [Kurento blog] 50 | Follow us on Twitter @[kurentoms]. 51 | 52 | Issue tracker 53 | ------------- 54 | 55 | Issues and bug reports should be posted to the [GitHub Kurento bugtracker] 56 | 57 | Licensing and distribution 58 | -------------------------- 59 | 60 | Licensed under the Apache License, Version 2.0 (the "License"); 61 | you may not use this file except in compliance with the License. 62 | You may obtain a copy of the License at 63 | 64 | http://www.apache.org/licenses/LICENSE-2.0 65 | 66 | Unless required by applicable law or agreed to in writing, software 67 | distributed under the License is distributed on an "AS IS" BASIS, 68 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 69 | See the License for the specific language governing permissions and 70 | limitations under the License. 71 | 72 | Contribution policy 73 | ------------------- 74 | 75 | You can contribute to the Kurento community through bug-reports, bug-fixes, new 76 | code or new documentation. For contributing to the Kurento community, drop a 77 | post to the [Kurento Public Mailing List] providing full information about your 78 | contribution and its value. In your contributions, you must comply with the 79 | following guidelines 80 | 81 | * You must specify the specific contents of your contribution either through a 82 | detailed bug description, through a pull-request or through a patch. 83 | * You must specify the licensing restrictions of the code you contribute. 84 | * For newly created code to be incorporated in the Kurento code-base, you must 85 | accept Kurento to own the code copyright, so that its open source nature is 86 | guaranteed. 87 | * You must justify appropriately the need and value of your contribution. The 88 | Kurento project has no obligations in relation to accepting contributions 89 | from third parties. 90 | * The Kurento project leaders have the right of asking for further 91 | explanations, tests or validations of any code contributed to the community 92 | before it being incorporated into the Kurento code-base. You must be ready to 93 | addressing all these kind of concerns before having your code approved. 94 | 95 | Support 96 | ------- 97 | 98 | The Kurento project provides community support through the [Kurento Public 99 | Mailing List] and through [StackOverflow] using the tags *kurento* and 100 | *fiware-kurento*. 101 | 102 | Before asking for support, please read first the [Kurento Netiquette Guidelines] 103 | 104 | [documentation]: http://www.kurento.org/documentation 105 | [FIWARE]: http://www.fiware.org 106 | [GitHub Kurento bugtracker]: https://github.com/Kurento/bugtracker/issues 107 | [GitHub Kurento Group]: https://github.com/kurento 108 | [kurentoms]: http://twitter.com/kurentoms 109 | [Kurento]: http://kurento.org 110 | [Kurento Blog]: http://www.kurento.org/blog 111 | [Kurento FIWARE Catalog Entry]: http://catalogue.fiware.org/enablers/stream-oriented-kurento 112 | [Kurento Netiquette Guidelines]: http://www.kurento.org/blog/kurento-netiquette-guidelines 113 | [Kurento Public Mailing list]: https://groups.google.com/forum/#!forum/kurento 114 | [KurentoImage]: https://secure.gravatar.com/avatar/21a2a12c56b2a91c8918d5779f1778bf?s=120 115 | [Apache 2.0 License]: http://www.apache.org/licenses/LICENSE-2.0 116 | [NUBOMEDIA]: http://www.nubomedia.eu 117 | [StackOverflow]: http://stackoverflow.com/search?q=kurento 118 | [Read-the-docs]: http://read-the-docs.readthedocs.org/ 119 | [readthedocs.org]: http://kurento.readthedocs.org/ 120 | [Open API specification]: http://kurento.github.io/doc-kurento/ 121 | [apiary.io]: http://docs.streamoriented.apiary.io/ 122 | [instructions]: http://www.kurento.org/docs/current/tutorials/node/tutorial-one2many.html 123 | -------------------------------------------------------------------------------- /kurento-one2many-call/keys/README.md: -------------------------------------------------------------------------------- 1 | [![License badge](https://img.shields.io/badge/license-Apache2-orange.svg)](http://www.apache.org/licenses/LICENSE-2.0) 2 | [![Documentation badge](https://readthedocs.org/projects/fiware-orion/badge/?version=latest)](http://doc-kurento.readthedocs.org/en/latest/) 3 | [![Docker badge](https://img.shields.io/docker/pulls/fiware/orion.svg)](https://hub.docker.com/r/fiware/stream-oriented-kurento/) 4 | [![Support badge]( https://img.shields.io/badge/support-sof-yellowgreen.svg)](http://stackoverflow.com/questions/tagged/kurento) 5 | 6 | This folder contains a dummy self-signed certificate only for demo purposses, 7 | **DON'T USE IT IN PRODUCTION**. 8 | -------------------------------------------------------------------------------- /kurento-one2many-call/keys/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDBjCCAe4CCQCuf5QfyX2oDDANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJB 3 | VTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 4 | cyBQdHkgTHRkMB4XDTE0MDkyOTA5NDczNVoXDTE1MDkyOTA5NDczNVowRTELMAkG 5 | A1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0 6 | IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB 7 | AMJOyOHJ+rJWJEQ7P7kKoWa31ff7hKNZxF6sYE5lFi3pBYWIY6kTN/iUaxJLROFo 8 | FhoC/M/STY76rIryix474v/6cRoG8N+GQBEn4IAP1UitWzVO6pVvBaIt5IKlhhfm 9 | YA1IMweCd03vLcaHTddNmFDBTks7QDwfenTaR5VjKYc3OtEhcG8dgLAnOjbbk2Hr 10 | 8wter2IeNgkhya3zyoXnTLT8m8IMg2mQaJs62Xlo9gs56urvVDWG4rhdGybj1uwU 11 | ZiDYyP4CFCUHS6UVt12vADP8vjbwmss2ScGsIf0NjaU+MpSdEbB82z4b2NiN8Wq+ 12 | rFA/JbvyeoWWHMoa7wkVs1MCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAYLRwV9fo 13 | AOhJfeK199Tv6oXoNSSSe10pVLnYxPcczCVQ4b9SomKFJFbmwtPVGi6w3m+8mV7F 14 | 9I2WKyeBHzmzfW2utZNupVybxgzEjuFLOVytSPdsB+DcJomOi8W/Cf2Vk8Wykb/t 15 | Ctr1gfOcI8rwEGKxm279spBs0u1snzoLyoimbMbiXbC82j1IiN3Jus08U07m/j7N 16 | hRBCpeHjUHT3CRpvYyTRnt+AyBd8BiyJB7nWmcNI1DksXPfehd62MAFS9e1ZE+dH 17 | Aavg/U8VpS7pcCQcPJvIJ2hehrt8L6kUk3YUYqZ0OeRZK27f2R5+wFlDF33esm3N 18 | dCSsLJlXyqAQFg== 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /kurento-one2many-call/keys/server.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIICijCCAXICAQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx 3 | ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcN 4 | AQEBBQADggEPADCCAQoCggEBAMJOyOHJ+rJWJEQ7P7kKoWa31ff7hKNZxF6sYE5l 5 | Fi3pBYWIY6kTN/iUaxJLROFoFhoC/M/STY76rIryix474v/6cRoG8N+GQBEn4IAP 6 | 1UitWzVO6pVvBaIt5IKlhhfmYA1IMweCd03vLcaHTddNmFDBTks7QDwfenTaR5Vj 7 | KYc3OtEhcG8dgLAnOjbbk2Hr8wter2IeNgkhya3zyoXnTLT8m8IMg2mQaJs62Xlo 8 | 9gs56urvVDWG4rhdGybj1uwUZiDYyP4CFCUHS6UVt12vADP8vjbwmss2ScGsIf0N 9 | jaU+MpSdEbB82z4b2NiN8Wq+rFA/JbvyeoWWHMoa7wkVs1MCAwEAAaAAMA0GCSqG 10 | SIb3DQEBCwUAA4IBAQBMszYHMpklgTF/3h1zAzKXUD9NrtZp8eWhL06nwVjQX8Ai 11 | EaCUiW0ypstokWcH9+30chd2OD++67NbxYUEucH8HrKpOoy6gs5L/mqgQ9Npz3OT 12 | TB1HI4kGtpVuUQ5D7L0596tKzMX/CgW/hRcHWl+PDkwGhQs1qZcJ8QN+YP6AkRrO 13 | 5sDdDB/BLrB9PtBQbPrYIQcHQ7ooYWz/G+goqRxzZ6rt0aU2uAB6l7c82ADLAqFJ 14 | qlw+xqVzEETVfqM5TXKK/wV3hgm4oSX5Q4SHLKF94ODOkWcnV4nfIKz7y+5XcQ3p 15 | PrGimI1br07okC5rO9cgLCR0Ks20PPFcM0FvInW/ 16 | -----END CERTIFICATE REQUEST----- 17 | -------------------------------------------------------------------------------- /kurento-one2many-call/keys/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAwk7I4cn6slYkRDs/uQqhZrfV9/uEo1nEXqxgTmUWLekFhYhj 3 | qRM3+JRrEktE4WgWGgL8z9JNjvqsivKLHjvi//pxGgbw34ZAESfggA/VSK1bNU7q 4 | lW8Foi3kgqWGF+ZgDUgzB4J3Te8txodN102YUMFOSztAPB96dNpHlWMphzc60SFw 5 | bx2AsCc6NtuTYevzC16vYh42CSHJrfPKhedMtPybwgyDaZBomzrZeWj2Cznq6u9U 6 | NYbiuF0bJuPW7BRmINjI/gIUJQdLpRW3Xa8AM/y+NvCayzZJwawh/Q2NpT4ylJ0R 7 | sHzbPhvY2I3xar6sUD8lu/J6hZYcyhrvCRWzUwIDAQABAoIBACwt56TW3MZxqZtN 8 | 8WYsUZheUispJ/ZQMcLo5JjOiSV1Jwk+gpJtyTse291z+bxagzP02/CQu4u32UVa 9 | cmE0cp+LHO4zB8964dREwdm8P91fdS6Au/uwG5LNZniCFCQZAFvkv52Ef4XbzQen 10 | uf4rKWerHBck6K0C5z/sZXxE6KtScE2ZLUmkhO0nkHM6MA6gFk2OMnB+oDTOWWPt 11 | 1mlreQlzuMYG/D4axviRYrOSYCE5Qu1SOw/DEOLQqqeBjQrKtAyOlFHZsIR6lBfe 12 | KHMChPUcYIwaowt2DcqH/A+AFXRtaifa6DvH8Yul+2vAp47UEpaenVfM5bpN33XV 13 | EzerjtECgYEA+xiXzblek67iQgRpc9eHSoqs4iRLhae8s8kpAG51Jz46Je+Dmium 14 | XV769oiUGUxBeoUb7ryW+4MOzHJaA1BfGejQSvwLIB9e4cnikqnAArcqbcAcOCL1 15 | aYYDiSmSmN/AokNZlPKEBFXP9bzXrU9smQJWNTHlcRl7JXfnwF+jwNsCgYEAxhpE 16 | SBr9vlUVHNh/S6C5i80NIYg6jCy2FgsmuzEqmcqV0pTyzegmq8bru+QmuvoUj2o4 17 | nVv4J9d1fLF6ECUVk9aK8UdJOOB6hAfurOdJCArgrsY/9t4uDzXfbPCdfSNQITE0 18 | XgeNGQX1EzvwwkBmyZKk0kLIr3syP8ZCWfXDROkCgYBR+dF1pJMv++R6UR5sZ20P 19 | 9P5ERj0xwXVl7MKqFWXCDhrFz9BTQPTrftrIKgbPy4mFCnf4FTHlov/t11dzxYWG 20 | 2+9Ey8yGDDfZ1yNVZn39ZPdBJXsRCLi+XrZAzYXCyyoEz6ArdJGNKMbgH2r6dfeq 21 | bIzgiQ2zQvJlZSQQNiksCQKBgCgwzAmU8EXdHRttEOZXBU3HnBJhgP9PUuHGAWWY 22 | 4/uvjhXbAiekIbRX9xt3fiQQ+HrgIfxK3F246K0TlKAR5f7IWAf7Xm+bmz+OHG4X 23 | vklTa6IJtpBvIwkS9PE1H75zm54gTW+GOKoK+12bm4zNZA0hIy9FPVHcvKUTpAJ8 24 | SdGBAoGAHLtJnB1NO4EgO6WtLQMXt7HrIbup8eZi8/82gC3422C+ooKIrYQ07qSw 25 | nBOO/G0OB4yd6vCE2x5+TWSSCYGgG5A8aIv5qP76RP4hovGHxG/y2tfotw5UuOrh 26 | nFWlTP4Urs8PeykvK9ao8r/T8BnPIC16U6ENYvAc0mRlFA2j1GA= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /kurento-one2many-call/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kurento-one2many-call", 3 | "version": "6.6.1-dev", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "cd static && bower install" 7 | }, 8 | "dependencies": { 9 | "express": "~4.12.4", 10 | "minimist": "^1.1.1", 11 | "ws": "~1.0.1", 12 | "kurento-client": "Kurento/kurento-client-js" 13 | }, 14 | "devDependencies": { 15 | "bower": "^1.4.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kurento-one2many-call/server.js: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2014-2015 Kurento (http://kurento.org/) 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the GNU Lesser General Public License 6 | * (LGPL) version 2.1 which accompanies this distribution, and is available at 7 | * http://www.gnu.org/licenses/lgpl-2.1.html 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | */ 15 | 16 | var path = require('path'); 17 | var url = require('url'); 18 | var express = require('express'); 19 | var minimist = require('minimist'); 20 | var ws = require('ws'); 21 | var kurento = require('kurento-client'); 22 | var fs = require('fs'); 23 | var https = require('https'); 24 | 25 | var argv = minimist(process.argv.slice(2), { 26 | default: { 27 | as_uri: 'https://localhost:8443/', 28 | ws_uri: 'ws://localhost:8888/kurento' 29 | } 30 | }); 31 | 32 | var options = 33 | { 34 | key: fs.readFileSync('keys/server.key'), 35 | cert: fs.readFileSync('keys/server.crt') 36 | }; 37 | 38 | var app = express(); 39 | 40 | /* 41 | * Definition of global variables. 42 | */ 43 | var idCounter = 1234; 44 | var candidatesQueue = {}; 45 | var kurentoClient = null; 46 | var presenter = null; 47 | var viewers = []; 48 | var noPresenterMessage = 'No active presenter. Try again later...'; 49 | var presenter = { 50 | pipeline : null, 51 | composite: null, 52 | webRtcEndpoint : {}, 53 | hubPorts : {} 54 | } 55 | 56 | /* 57 | * Server startup 58 | */ 59 | var asUrl = url.parse(argv.as_uri); 60 | var port = asUrl.port; 61 | var server = https.createServer(options, app).listen(port, function() { 62 | console.log('Kurento Tutorial started'); 63 | console.log('Open ' + url.format(asUrl) + ' with a WebRTC capable browser'); 64 | }); 65 | 66 | var wss = new ws.Server({ 67 | server : server, 68 | path : '/one2many' 69 | }); 70 | 71 | function nextUniqueId() { 72 | idCounter++; 73 | return idCounter.toString(); 74 | } 75 | 76 | /* 77 | * Management of WebSocket messages 78 | */ 79 | wss.on('connection', function(ws) { 80 | 81 | var sessionId = nextUniqueId(); 82 | //console.log('Connection received with sessionId ' + sessionId); 83 | 84 | ws.on('error', function(error) { 85 | console.log('Connection ' + sessionId + ' error'); 86 | stop(sessionId); 87 | }); 88 | 89 | ws.on('close', function() { 90 | console.log('Connection ' + sessionId + ' closed'); 91 | stop(sessionId); 92 | }); 93 | 94 | ws.on('message', function(_message) { 95 | var message = JSON.parse(_message); 96 | console.log('Connection ' + sessionId + ' received message ', message); 97 | 98 | switch (message.id) { 99 | case 'presenter': 100 | startPresenter(sessionId, ws, message.sdpOffer, function(error, sdpAnswer) { 101 | if (error) { 102 | return ws.send(JSON.stringify({ 103 | id : 'presenterResponse', 104 | response : 'rejected', 105 | message : error 106 | })); 107 | } 108 | ws.send(JSON.stringify({ 109 | id : 'presenterResponse', 110 | response : 'accepted', 111 | sdpAnswer : sdpAnswer 112 | })); 113 | }); 114 | break; 115 | 116 | case 'viewer': 117 | startViewer(sessionId, ws, message.sdpOffer, function(error, sdpAnswer) { 118 | if (error) { 119 | return ws.send(JSON.stringify({ 120 | id : 'viewerResponse', 121 | response : 'rejected', 122 | message : error 123 | })); 124 | } 125 | 126 | ws.send(JSON.stringify({ 127 | id : 'viewerResponse', 128 | response : 'accepted', 129 | sdpAnswer : sdpAnswer 130 | })); 131 | }); 132 | break; 133 | 134 | case 'stop': 135 | stop(sessionId); 136 | break; 137 | 138 | case 'onIceCandidate': 139 | onIceCandidate(sessionId, message.candidate); 140 | break; 141 | 142 | case 'action1': 143 | presenter.composite.showView(parseInt(sessionId)); 144 | if (presenter.composite != null) { 145 | console.log("getGStreamerDot"); 146 | presenter.pipeline.getGstreamerDot(function(err, ret){ 147 | if(err) { 148 | return console.log(err); 149 | } 150 | var fs = require('fs'); 151 | fs.writeFile("pipeline.dot", ret, function(err) { 152 | if(err) { 153 | return console.log(err); 154 | } 155 | console.log("The file pipeline.dot was saved!"); 156 | }); 157 | }); 158 | presenter.composite.getGstreamerDot(function(err, ret){ 159 | if(err) { 160 | return console.log(err); 161 | } 162 | var fs = require('fs'); 163 | fs.writeFile("composite.dot", ret, function(err) { 164 | if(err) { 165 | return console.log(err); 166 | } 167 | console.log("The file composite.dot was saved!"); 168 | }); 169 | }); 170 | if (presenter.webRtcEndpoint[sessionId]) { 171 | presenter.webRtcEndpoint[sessionId].getGstreamerDot(function (err, ret) { 172 | if (err) { 173 | return console.log(err); 174 | } 175 | var fs = require('fs'); 176 | fs.writeFile("webrtcEndpointPresenter.dot", ret, function (err) { 177 | if (err) { 178 | return console.log(err); 179 | } 180 | console.log("The file webrtcEndpointPresenter.dot was saved!"); 181 | }); 182 | }); 183 | } 184 | if (viewers[sessionId] && viewers[sessionId].webRtcEndpoint) { 185 | viewers[sessionId].webRtcEndpoint.getGstreamerDot(function (err, ret) { 186 | if (err) { 187 | return console.log(err); 188 | } 189 | var fs = require('fs'); 190 | fs.writeFile("webrtcEndpointViewer.dot", ret, function (err) { 191 | if (err) { 192 | return console.log(err); 193 | } 194 | console.log("The file webrtcEndpointViewer.dot was saved!"); 195 | }); 196 | }); 197 | } 198 | } 199 | ws.send(JSON.stringify({ 200 | id : 'action1', 201 | message : 'accepted' 202 | })); 203 | break; 204 | 205 | case 'action2': 206 | presenter.composite.hideView(parseInt(sessionId)); 207 | ws.send(JSON.stringify({ 208 | id : 'action2', 209 | message : 'accepted' 210 | })); 211 | break; 212 | 213 | default: 214 | ws.send(JSON.stringify({ 215 | id : 'error', 216 | message : 'Invalid message ' + message 217 | })); 218 | break; 219 | } 220 | }); 221 | }); 222 | 223 | /* 224 | * Definition of functions 225 | */ 226 | 227 | // Recover kurentoClient for the first time. 228 | function getKurentoClient(callback) { 229 | if (kurentoClient !== null) { 230 | return callback(null, kurentoClient); 231 | } 232 | 233 | kurento(argv.ws_uri, function(error, _kurentoClient) { 234 | if (error) { 235 | console.log("Could not find media server at address " + argv.ws_uri); 236 | return callback("Could not find media server at address" + argv.ws_uri 237 | + ". Exiting with error " + error); 238 | } 239 | 240 | kurentoClient = _kurentoClient; 241 | callback(null, kurentoClient); 242 | }); 243 | } 244 | 245 | function startPresenter(sessionId, ws, sdpOffer, callback) { 246 | clearCandidatesQueue(sessionId); 247 | 248 | getKurentoClient(function(error, kurentoClient) { 249 | if (presenter.pipeline === null) { 250 | kurentoClient.create('MediaPipeline', function(error, _pipeline) { 251 | if (error) { 252 | return callback(error); 253 | } 254 | presenter.pipeline = _pipeline; 255 | 256 | presenter.pipeline.create('Composite', function(error, _composite) { 257 | if (error) { 258 | return callback(error); 259 | } 260 | presenter.composite = _composite; 261 | //addPlayer(sessionId, ws, sdpOffer, callback); 262 | addPresenter(sessionId, ws, sdpOffer, callback); 263 | }); 264 | }); 265 | } else { 266 | addPresenter(sessionId, ws, sdpOffer, callback); 267 | } 268 | }); 269 | } 270 | 271 | //var playerURI="http://www.youtubeinmp4.com/redirect.php?video=x_cmZyYHMTk&r=D396bQeGXWJJXzm6y0qWbDPg8A0mWpViMlVWDWE76T4%3D"; 272 | var playerURI="https://192.168.16.112:8443/sample.mp4"; 273 | function addPlayer(sessionId, ws, sdpOffer, callback) { 274 | // Create player 275 | console.log('Creating PlayerEndpoint'); 276 | presenter.pipeline.create('PlayerEndpoint', {uri: playerURI}, function(error, playerEndpoint) { 277 | if (error) return wsError(ws, "ERROR 3: " + error); 278 | 279 | playerEndpoint.on('EndOfStream', function() { 280 | console.log('END OF STREAM'); 281 | pipeline.release(); 282 | }); 283 | 284 | console.log('Now Playing: ' + playerURI); 285 | playerEndpoint.play(function(error) { 286 | if (error) return wsError(ws, "ERROR 4: " + error); 287 | 288 | presenter.composite.createHubPort(function (error, _hubPort) { 289 | if (error) { 290 | console.log("error creating hubport for participant"); 291 | return calback(error); 292 | } 293 | presenter.hubPorts[sessionId] = _hubPort; 294 | 295 | _hubPort.setMaxOutputBitrate(parseInt(sessionId), function(err, obj){ 296 | _hubPort.getMaxOutputBitrate(function(err, obj){ 297 | console.log("hubPort.getMaxOuputBitrate(session id) = " + obj); 298 | }); 299 | 300 | }); 301 | playerEndpoint.connect(_hubPort, function() { 302 | console.log("PlayerEndpoint connected to hubport."); 303 | }); 304 | }); 305 | }); 306 | 307 | }); 308 | 309 | } 310 | 311 | function addPresenter(sessionId, ws, sdpOffer, callback) { 312 | console.warn("startPresenter sid=" + sessionId); 313 | presenter.pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { 314 | if (error) { 315 | stop(sessionId); 316 | return callback(error); 317 | } 318 | 319 | console.log("addPresenter " + sessionId + " : " + webRtcEndpoint); 320 | presenter.webRtcEndpoint[sessionId] = webRtcEndpoint; 321 | presenter.composite.createHubPort(function (error, _hubPort) { 322 | if (error) { 323 | console.log("error creating hubport for participant"); 324 | return calback(error); 325 | } 326 | 327 | presenter.hubPorts[sessionId] = _hubPort; 328 | presenter.pipeline.create('HLSConvertor', function(error, _HLSConvertor) { 329 | if (error) { 330 | return callback(error); 331 | } 332 | console.log("HLSConvertor:" + JSON.stringify(_HLSConvertor) ); 333 | webRtcEndpoint.connect(_HLSConvertor); 334 | _HLSConvertor.connect(_hubPort); 335 | }); 336 | 337 | // presenter.hubPorts[sessionId] = _hubPort; 338 | // webRtcEndpoint.connect(_hubPort); 339 | }); 340 | 341 | if (candidatesQueue[sessionId]) { 342 | while(candidatesQueue[sessionId].length) { 343 | var candidate = candidatesQueue[sessionId].shift(); 344 | webRtcEndpoint.addIceCandidate(candidate); 345 | } 346 | } 347 | 348 | webRtcEndpoint.on('OnIceCandidate', function(event) { 349 | var candidate = kurento.register.complexTypes.IceCandidate(event.candidate); 350 | ws.send(JSON.stringify({ 351 | id : 'iceCandidate', 352 | candidate : candidate 353 | })); 354 | }); 355 | 356 | webRtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) { 357 | if (error) { 358 | stop(sessionId); 359 | return callback(error); 360 | } 361 | 362 | if (presenter === null) { 363 | stop(sessionId); 364 | return callback(noPresenterMessage); 365 | } 366 | 367 | callback(null, sdpAnswer); 368 | }); 369 | 370 | webRtcEndpoint.gatherCandidates(function(error) { 371 | if (error) { 372 | stop(sessionId); 373 | return callback(error); 374 | } 375 | }); 376 | }); 377 | } 378 | 379 | 380 | function startViewer(sessionId, ws, sdpOffer, callback) { 381 | if (presenter.pipeline === null) { 382 | getKurentoClient(function(error, kurentoClient) { 383 | if (presenter.pipeline === null) { 384 | kurentoClient.create('MediaPipeline', function(error, _pipeline) { 385 | if (error) { 386 | return callback(error); 387 | } 388 | presenter.pipeline = _pipeline; 389 | 390 | presenter.pipeline.create('Composite', function(error, _composite) { 391 | if (error) { 392 | return callback(error); 393 | } 394 | presenter.composite = _composite; 395 | addViewer(sessionId, ws, sdpOffer, callback); 396 | }); 397 | }); 398 | } 399 | }); 400 | } else { 401 | addViewer(sessionId, ws, sdpOffer, callback); 402 | } 403 | } 404 | 405 | function addViewer(sessionId, ws, sdpOffer, callback) { 406 | clearCandidatesQueue(sessionId); 407 | 408 | if (presenter === null) { 409 | stop(sessionId); 410 | return callback(noPresenterMessage); 411 | } 412 | 413 | presenter.pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { 414 | if (error) { 415 | stop(sessionId); 416 | return callback(error); 417 | } 418 | viewers[sessionId] = { 419 | "webRtcEndpoint" : webRtcEndpoint, 420 | "hubPort" : null, 421 | "ws" : ws 422 | } 423 | 424 | if (presenter === null) { 425 | stop(sessionId); 426 | return callback(noPresenterMessage); 427 | } 428 | 429 | presenter.composite.createHubPort(function (error, _hubPort) { 430 | if (error) { 431 | console.log("error creating hubport for participant"); 432 | return calback(error); 433 | } 434 | viewers[sessionId].hubPort = _hubPort; 435 | _hubPort.connect(webRtcEndpoint, function() { 436 | console.log("connect to hub port"); 437 | }); 438 | }); 439 | 440 | // presenter.pipeline.create('clockoverlay', function(error, _clockoverlay) { 441 | // if (error) { 442 | // return callback(error); 443 | // } 444 | // console.log("clockoverlay:" + JSON.stringify(_clockoverlay) ); 445 | // 446 | // presenter.composite.createHubPort(function (error, _hubPort) { 447 | // if (error) { 448 | // console.log("error creating hubport for participant"); 449 | // return calback(error); 450 | // } 451 | // viewers[sessionId].hubPort = _hubPort; 452 | // console.log("create hub port"); 453 | // console.log(_hubPort); 454 | // _hubPort.connect(_textoverlay, function() { 455 | // _textoverlay.connect(webRtcEndpoint, function() { 456 | // console.log("connect to hub port"); 457 | // webRtcEndpoint.getStats("VIDEO", function (arg1, arg2) { 458 | // console.log(arg1); 459 | // console.log(arg2); 460 | // }); 461 | // }); 462 | // 463 | // }); 464 | // }); 465 | // }); 466 | 467 | 468 | if (candidatesQueue[sessionId]) { 469 | while(candidatesQueue[sessionId].length) { 470 | var candidate = candidatesQueue[sessionId].shift(); 471 | webRtcEndpoint.addIceCandidate(candidate); 472 | } 473 | } 474 | 475 | webRtcEndpoint.on('OnIceCandidate', function(event) { 476 | var candidate = kurento.register.complexTypes.IceCandidate(event.candidate); 477 | ws.send(JSON.stringify({ 478 | id : 'iceCandidate', 479 | candidate : candidate 480 | })); 481 | }); 482 | 483 | webRtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) { 484 | if (error) { 485 | stop(sessionId); 486 | return callback(error); 487 | } 488 | if (presenter === null) { 489 | stop(sessionId); 490 | return callback(noPresenterMessage); 491 | } 492 | 493 | callback(null, sdpAnswer); 494 | webRtcEndpoint.gatherCandidates(function(error) { 495 | if (error) { 496 | stop(sessionId); 497 | return callback(error); 498 | } 499 | }); 500 | }); 501 | }); 502 | } 503 | 504 | function clearCandidatesQueue(sessionId) { 505 | if (candidatesQueue[sessionId]) { 506 | delete candidatesQueue[sessionId]; 507 | } 508 | } 509 | 510 | function stop(sessionId) { 511 | if (presenter !== null && presenter.webRtcEndpoint[sessionId]) { 512 | //presenter.webRtcEndpoint[sessionId].disconnect(presenter.hubPorts[sessionId], "VIDEO"); 513 | presenter.hubPorts[sessionId].release(); 514 | presenter.webRtcEndpoint[sessionId].release(); 515 | delete presenter.webRtcEndpoint[sessionId]; 516 | } else if (viewers[sessionId]) { 517 | viewers[sessionId].hubPort.release(); 518 | viewers[sessionId].webRtcEndpoint.release(); 519 | delete viewers[sessionId]; 520 | } 521 | 522 | clearCandidatesQueue(sessionId); 523 | } 524 | 525 | function onIceCandidate(sessionId, _candidate) { 526 | var candidate = kurento.register.complexTypes.IceCandidate(_candidate); 527 | 528 | if (presenter.webRtcEndpoint[sessionId]) { 529 | //console.info('Sending presenter candidate'); 530 | presenter.webRtcEndpoint[sessionId].addIceCandidate(candidate); 531 | } 532 | else if (viewers[sessionId] && viewers[sessionId].webRtcEndpoint) { 533 | //console.info('Sending viewer candidate'); 534 | viewers[sessionId].webRtcEndpoint.addIceCandidate(candidate); 535 | } 536 | else { 537 | //console.info('Queueing candidate'); 538 | if (!candidatesQueue[sessionId]) { 539 | candidatesQueue[sessionId] = []; 540 | } 541 | candidatesQueue[sessionId].push(candidate); 542 | } 543 | } 544 | 545 | app.use(express.static(path.join(__dirname, 'static'))); 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | // 558 | // 559 | ///* 560 | // * (C) Copyright 2014-2015 Kurento (http://kurento.org/) 561 | // * 562 | // * Licensed under the Apache License, Version 2.0 (the "License"); 563 | // * you may not use this file except in compliance with the License. 564 | // * You may obtain a copy of the License at 565 | // * 566 | // * http://www.apache.org/licenses/LICENSE-2.0 567 | // * 568 | // * Unless required by applicable law or agreed to in writing, software 569 | // * distributed under the License is distributed on an "AS IS" BASIS, 570 | // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 571 | // * See the License for the specific language governing permissions and 572 | // * limitations under the License. 573 | // * 574 | // */ 575 | // 576 | //var path = require('path'); 577 | //var url = require('url'); 578 | //var express = require('express'); 579 | //var minimist = require('minimist'); 580 | //var ws = require('ws'); 581 | //var kurento = require('kurento-client'); 582 | //var fs = require('fs'); 583 | //var https = require('https'); 584 | // 585 | //var argv = minimist(process.argv.slice(2), { 586 | // default: { 587 | // as_uri: 'https://localhost:8443/', 588 | // ws_uri: 'ws://localhost:8888/kurento' 589 | // } 590 | //}); 591 | // 592 | //var options = 593 | //{ 594 | // key: fs.readFileSync('keys/server.key'), 595 | // cert: fs.readFileSync('keys/server.crt') 596 | //}; 597 | // 598 | //var app = express(); 599 | // 600 | ///* 601 | // * Definition of global variables. 602 | // */ 603 | //var idCounter = 0; 604 | //var candidatesQueue = {}; 605 | //var kurentoClient = null; 606 | //var presenter = null; 607 | //var viewers = []; 608 | //var noPresenterMessage = 'No active presenter. Try again later...'; 609 | // 610 | ///* 611 | // * Server startup 612 | // */ 613 | //var asUrl = url.parse(argv.as_uri); 614 | //var port = asUrl.port; 615 | //var server = https.createServer(options, app).listen(port, function() { 616 | // console.log('Kurento Tutorial started'); 617 | // console.log('Open ' + url.format(asUrl) + ' with a WebRTC capable browser'); 618 | //}); 619 | // 620 | //var wss = new ws.Server({ 621 | // server : server, 622 | // path : '/one2many' 623 | //}); 624 | // 625 | //function nextUniqueId() { 626 | // idCounter++; 627 | // return idCounter.toString(); 628 | //} 629 | // 630 | ///* 631 | // * Management of WebSocket messages 632 | // */ 633 | //wss.on('connection', function(ws) { 634 | // 635 | // var sessionId = nextUniqueId(); 636 | // console.log('Connection received with sessionId ' + sessionId); 637 | // 638 | // ws.on('error', function(error) { 639 | // console.log('Connection ' + sessionId + ' error'); 640 | // stop(sessionId); 641 | // }); 642 | // 643 | // ws.on('close', function() { 644 | // console.log('Connection ' + sessionId + ' closed'); 645 | // stop(sessionId); 646 | // }); 647 | // 648 | // ws.on('message', function(_message) { 649 | // var message = JSON.parse(_message); 650 | // console.log('Connection ' + sessionId + ' received message ', message); 651 | // 652 | // switch (message.id) { 653 | // case 'presenter': 654 | // startPresenter(sessionId, ws, message.sdpOffer, function(error, sdpAnswer) { 655 | // if (error) { 656 | // return ws.send(JSON.stringify({ 657 | // id : 'presenterResponse', 658 | // response : 'rejected', 659 | // message : error 660 | // })); 661 | // } 662 | // ws.send(JSON.stringify({ 663 | // id : 'presenterResponse', 664 | // response : 'accepted', 665 | // sdpAnswer : sdpAnswer 666 | // })); 667 | // }); 668 | // break; 669 | // 670 | // case 'viewer': 671 | // startViewer(sessionId, ws, message.sdpOffer, function(error, sdpAnswer) { 672 | // if (error) { 673 | // return ws.send(JSON.stringify({ 674 | // id : 'viewerResponse', 675 | // response : 'rejected', 676 | // message : error 677 | // })); 678 | // } 679 | // 680 | // ws.send(JSON.stringify({ 681 | // id : 'viewerResponse', 682 | // response : 'accepted', 683 | // sdpAnswer : sdpAnswer 684 | // })); 685 | // }); 686 | // break; 687 | // 688 | // case 'stop': 689 | // stop(sessionId); 690 | // break; 691 | // 692 | // case 'onIceCandidate': 693 | // onIceCandidate(sessionId, message.candidate); 694 | // break; 695 | // 696 | // default: 697 | // ws.send(JSON.stringify({ 698 | // id : 'error', 699 | // message : 'Invalid message ' + message 700 | // })); 701 | // break; 702 | // } 703 | // }); 704 | //}); 705 | // 706 | ///* 707 | // * Definition of functions 708 | // */ 709 | // 710 | //// Recover kurentoClient for the first time. 711 | //function getKurentoClient(callback) { 712 | // if (kurentoClient !== null) { 713 | // return callback(null, kurentoClient); 714 | // } 715 | // 716 | // kurento(argv.ws_uri, function(error, _kurentoClient) { 717 | // if (error) { 718 | // console.log("Could not find media server at address " + argv.ws_uri); 719 | // return callback("Could not find media server at address" + argv.ws_uri 720 | // + ". Exiting with error " + error); 721 | // } 722 | // 723 | // kurentoClient = _kurentoClient; 724 | // callback(null, kurentoClient); 725 | // }); 726 | //} 727 | // 728 | //function startPresenter(sessionId, ws, sdpOffer, callback) { 729 | // clearCandidatesQueue(sessionId); 730 | // 731 | // if (presenter !== null) { 732 | // stop(sessionId); 733 | // return callback("Another user is currently acting as presenter. Try again later ..."); 734 | // } 735 | // 736 | // presenter = { 737 | // id : sessionId, 738 | // pipeline : null, 739 | // webRtcEndpoint : null 740 | // } 741 | // 742 | // getKurentoClient(function(error, kurentoClient) { 743 | // if (error) { 744 | // stop(sessionId); 745 | // return callback(error); 746 | // } 747 | // 748 | // if (presenter === null) { 749 | // stop(sessionId); 750 | // return callback(noPresenterMessage); 751 | // } 752 | // 753 | // kurentoClient.create('MediaPipeline', function(error, pipeline) { 754 | // if (error) { 755 | // stop(sessionId); 756 | // return callback(error); 757 | // } 758 | // 759 | // if (presenter === null) { 760 | // stop(sessionId); 761 | // return callback(noPresenterMessage); 762 | // } 763 | // 764 | // presenter.pipeline = pipeline; 765 | // pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { 766 | // if (error) { 767 | // stop(sessionId); 768 | // return callback(error); 769 | // } 770 | // 771 | // if (presenter === null) { 772 | // stop(sessionId); 773 | // return callback(noPresenterMessage); 774 | // } 775 | // 776 | // presenter.webRtcEndpoint = webRtcEndpoint; 777 | // 778 | // if (candidatesQueue[sessionId]) { 779 | // while(candidatesQueue[sessionId].length) { 780 | // var candidate = candidatesQueue[sessionId].shift(); 781 | // webRtcEndpoint.addIceCandidate(candidate); 782 | // } 783 | // } 784 | // 785 | // webRtcEndpoint.on('OnIceCandidate', function(event) { 786 | // var candidate = kurento.getComplexType('IceCandidate')(event.candidate); 787 | // ws.send(JSON.stringify({ 788 | // id : 'iceCandidate', 789 | // candidate : candidate 790 | // })); 791 | // }); 792 | // 793 | // webRtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) { 794 | // if (error) { 795 | // stop(sessionId); 796 | // return callback(error); 797 | // } 798 | // 799 | // if (presenter === null) { 800 | // stop(sessionId); 801 | // return callback(noPresenterMessage); 802 | // } 803 | // 804 | // callback(null, sdpAnswer); 805 | // }); 806 | // 807 | // webRtcEndpoint.gatherCandidates(function(error) { 808 | // if (error) { 809 | // stop(sessionId); 810 | // return callback(error); 811 | // } 812 | // }); 813 | // }); 814 | // }); 815 | // }); 816 | //} 817 | // 818 | //function startViewer(sessionId, ws, sdpOffer, callback) { 819 | // clearCandidatesQueue(sessionId); 820 | // 821 | // if (presenter === null) { 822 | // stop(sessionId); 823 | // return callback(noPresenterMessage); 824 | // } 825 | // 826 | // presenter.pipeline.create('WebRtcEndpoint', function(error, webRtcEndpoint) { 827 | // if (error) { 828 | // stop(sessionId); 829 | // return callback(error); 830 | // } 831 | // viewers[sessionId] = { 832 | // "webRtcEndpoint" : webRtcEndpoint, 833 | // "ws" : ws 834 | // } 835 | // 836 | // if (presenter === null) { 837 | // stop(sessionId); 838 | // return callback(noPresenterMessage); 839 | // } 840 | // 841 | // if (candidatesQueue[sessionId]) { 842 | // while(candidatesQueue[sessionId].length) { 843 | // var candidate = candidatesQueue[sessionId].shift(); 844 | // webRtcEndpoint.addIceCandidate(candidate); 845 | // } 846 | // } 847 | // 848 | // webRtcEndpoint.on('OnIceCandidate', function(event) { 849 | // var candidate = kurento.getComplexType('IceCandidate')(event.candidate); 850 | // ws.send(JSON.stringify({ 851 | // id : 'iceCandidate', 852 | // candidate : candidate 853 | // })); 854 | // }); 855 | // 856 | // webRtcEndpoint.processOffer(sdpOffer, function(error, sdpAnswer) { 857 | // if (error) { 858 | // stop(sessionId); 859 | // return callback(error); 860 | // } 861 | // if (presenter === null) { 862 | // stop(sessionId); 863 | // return callback(noPresenterMessage); 864 | // } 865 | // 866 | // presenter.webRtcEndpoint.connect(webRtcEndpoint, function(error) { 867 | // if (error) { 868 | // stop(sessionId); 869 | // return callback(error); 870 | // } 871 | // if (presenter === null) { 872 | // stop(sessionId); 873 | // return callback(noPresenterMessage); 874 | // } 875 | // 876 | // callback(null, sdpAnswer); 877 | // webRtcEndpoint.gatherCandidates(function(error) { 878 | // if (error) { 879 | // stop(sessionId); 880 | // return callback(error); 881 | // } 882 | // }); 883 | // }); 884 | // }); 885 | // }); 886 | //} 887 | // 888 | //function clearCandidatesQueue(sessionId) { 889 | // if (candidatesQueue[sessionId]) { 890 | // delete candidatesQueue[sessionId]; 891 | // } 892 | //} 893 | // 894 | //function stop(sessionId) { 895 | // if (presenter !== null && presenter.id == sessionId) { 896 | // for (var i in viewers) { 897 | // var viewer = viewers[i]; 898 | // if (viewer.ws) { 899 | // viewer.ws.send(JSON.stringify({ 900 | // id : 'stopCommunication' 901 | // })); 902 | // } 903 | // } 904 | // presenter.pipeline.release(); 905 | // presenter = null; 906 | // viewers = []; 907 | // 908 | // } else if (viewers[sessionId]) { 909 | // viewers[sessionId].webRtcEndpoint.release(); 910 | // delete viewers[sessionId]; 911 | // } 912 | // 913 | // clearCandidatesQueue(sessionId); 914 | // 915 | // if (viewers.length < 1 && !presenter) { 916 | // console.log('Closing kurento client'); 917 | // kurentoClient.close(); 918 | // kurentoClient = null; 919 | // } 920 | //} 921 | // 922 | //function onIceCandidate(sessionId, _candidate) { 923 | // var candidate = kurento.getComplexType('IceCandidate')(_candidate); 924 | // 925 | // if (presenter && presenter.id === sessionId && presenter.webRtcEndpoint) { 926 | // console.info('Sending presenter candidate'); 927 | // presenter.webRtcEndpoint.addIceCandidate(candidate); 928 | // } 929 | // else if (viewers[sessionId] && viewers[sessionId].webRtcEndpoint) { 930 | // console.info('Sending viewer candidate'); 931 | // viewers[sessionId].webRtcEndpoint.addIceCandidate(candidate); 932 | // } 933 | // else { 934 | // console.info('Queueing candidate'); 935 | // if (!candidatesQueue[sessionId]) { 936 | // candidatesQueue[sessionId] = []; 937 | // } 938 | // candidatesQueue[sessionId].push(candidate); 939 | // } 940 | //} 941 | // 942 | //app.use(express.static(path.join(__dirname, 'static'))); 943 | -------------------------------------------------------------------------------- /kurento-one2many-call/static/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kurento-one2many-call", 3 | "description": "Kurento Browser JavaScript Tutorial", 4 | "authors": [ 5 | "Kurento " 6 | ], 7 | "main": "index.html", 8 | "moduleType": [ 9 | "globals" 10 | ], 11 | "license": "ALv2", 12 | "homepage": "http://www.kurento.org/", 13 | "private": true, 14 | "ignore": [ 15 | "**/.*", 16 | "node_modules", 17 | "bower_components", 18 | "test", 19 | "tests" 20 | ], 21 | "dependencies": { 22 | "adapter.js": "v0.2.9", 23 | "bootstrap": "~3.3.0", 24 | "ekko-lightbox": "~3.3.0", 25 | "demo-console": "1.5.1", 26 | "kurento-utils": "master" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /kurento-one2many-call/static/css/kurento.css: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2014-2015 Kurento (http://kurento.org/) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | @CHARSET "UTF-8"; 18 | 19 | html { 20 | position: relative; 21 | min-height: 100%; 22 | } 23 | 24 | body { 25 | padding-top: 40px; 26 | body 27 | } 28 | 29 | video,#console { 30 | display: block; 31 | font-size: 14px; 32 | line-height: 1.42857143; 33 | color: #555; 34 | background-color: #fff; 35 | background-image: none; 36 | border: 1px solid #ccc; 37 | border-radius: 4px; 38 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); 39 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); 40 | -webkit-transition: border-color ease-in-out .15s, box-shadow 41 | ease-in-out .15s; 42 | transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; 43 | } 44 | 45 | #console { 46 | min-height: 120px; 47 | max-height: 360px; 48 | } 49 | 50 | #videoContainer { 51 | position: absolute; 52 | float: left; 53 | } 54 | 55 | #videoBig { 56 | width: 640px; 57 | height: 480px; 58 | top: 0; 59 | left: 0; 60 | z-index: 1; 61 | } 62 | 63 | div#videoSmall { 64 | width: 240px; 65 | height: 180px; 66 | padding: 0px; 67 | position: absolute; 68 | top: 15px; 69 | left: 400px; 70 | cursor: pointer; 71 | z-index: 10; 72 | padding: 0px; 73 | } 74 | 75 | div.dragged { 76 | cursor: all-scroll !important; 77 | border-color: blue !important; 78 | z-index: 10 !important; 79 | } 80 | -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/kurento.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/kurento.png -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/naevatec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/naevatec.png -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/pipeline.png -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/spinner.gif -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/transparent-1px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/transparent-1px.png -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/urjc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/urjc.gif -------------------------------------------------------------------------------- /kurento-one2many-call/static/img/webrtc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swarmnyc/HLSConvertor/53840ab2b803ebfb1f94812e86192360ef71178b/kurento-one2many-call/static/img/webrtc.png -------------------------------------------------------------------------------- /kurento-one2many-call/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Kurento Tutorial 3: Video Call 1 to N with WebRTC 26 | 27 | 28 | 29 |
30 | 47 |
48 | 49 |
50 | 53 |
54 |
55 |
56 | 68 |
69 |
70 |

71 |
72 |
    73 |
    74 |
    75 |
    76 |
    77 | 78 |
    79 |
    80 |
    81 |
    82 | 83 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /kurento-one2many-call/static/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2014-2015 Kurento (http://kurento.org/) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | var ws = new WebSocket('wss://' + location.host + '/one2many'); 19 | var video; 20 | var webRtcPeer; 21 | 22 | window.onload = function() { 23 | console = new Console(); 24 | video = document.getElementById('video'); 25 | 26 | document.getElementById('call').addEventListener('click', function() { presenter(); } ); 27 | document.getElementById('viewer').addEventListener('click', function() { viewer(); } ); 28 | document.getElementById('terminate').addEventListener('click', function() { stop(); } ); 29 | } 30 | 31 | window.onbeforeunload = function() { 32 | ws.close(); 33 | } 34 | 35 | ws.onmessage = function(message) { 36 | var parsedMessage = JSON.parse(message.data); 37 | console.info('Received message: ' + message.data); 38 | 39 | switch (parsedMessage.id) { 40 | case 'presenterResponse': 41 | presenterResponse(parsedMessage); 42 | break; 43 | case 'viewerResponse': 44 | viewerResponse(parsedMessage); 45 | break; 46 | case 'stopCommunication': 47 | dispose(); 48 | break; 49 | case 'iceCandidate': 50 | webRtcPeer.addIceCandidate(parsedMessage.candidate) 51 | break; 52 | default: 53 | console.error('Unrecognized message', parsedMessage); 54 | } 55 | } 56 | 57 | function presenterResponse(message) { 58 | if (message.response != 'accepted') { 59 | var errorMsg = message.message ? message.message : 'Unknow error'; 60 | console.warn('Call not accepted for the following reason: ' + errorMsg); 61 | dispose(); 62 | } else { 63 | webRtcPeer.processAnswer(message.sdpAnswer); 64 | } 65 | } 66 | 67 | function viewerResponse(message) { 68 | if (message.response != 'accepted') { 69 | var errorMsg = message.message ? message.message : 'Unknow error'; 70 | console.warn('Call not accepted for the following reason: ' + errorMsg); 71 | dispose(); 72 | } else { 73 | webRtcPeer.processAnswer(message.sdpAnswer); 74 | } 75 | } 76 | 77 | function presenter() { 78 | if (!webRtcPeer) { 79 | showSpinner(video); 80 | 81 | var options = { 82 | localVideo: video, 83 | onicecandidate : onIceCandidate 84 | } 85 | 86 | webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options, function(error) { 87 | if(error) return onError(error); 88 | 89 | this.generateOffer(onOfferPresenter); 90 | }); 91 | } 92 | } 93 | 94 | function onOfferPresenter(error, offerSdp) { 95 | if (error) return onError(error); 96 | 97 | var message = { 98 | id : 'presenter', 99 | sdpOffer : offerSdp 100 | }; 101 | sendMessage(message); 102 | } 103 | 104 | function viewer() { 105 | if (!webRtcPeer) { 106 | showSpinner(video); 107 | 108 | var options = { 109 | remoteVideo: video, 110 | onicecandidate : onIceCandidate 111 | } 112 | 113 | webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(options, function(error) { 114 | if(error) return onError(error); 115 | 116 | this.generateOffer(onOfferViewer); 117 | }); 118 | } 119 | } 120 | 121 | function onOfferViewer(error, offerSdp) { 122 | if (error) return onError(error) 123 | 124 | var message = { 125 | id : 'viewer', 126 | sdpOffer : offerSdp 127 | } 128 | sendMessage(message); 129 | } 130 | 131 | function onIceCandidate(candidate) { 132 | console.log('Local candidate' + JSON.stringify(candidate)); 133 | 134 | var message = { 135 | id : 'onIceCandidate', 136 | candidate : candidate 137 | } 138 | sendMessage(message); 139 | } 140 | 141 | function stop() { 142 | if (webRtcPeer) { 143 | var message = { 144 | id : 'stop' 145 | } 146 | sendMessage(message); 147 | dispose(); 148 | } 149 | } 150 | 151 | function dispose() { 152 | if (webRtcPeer) { 153 | webRtcPeer.dispose(); 154 | webRtcPeer = null; 155 | } 156 | hideSpinner(video); 157 | } 158 | 159 | function sendMessage(message) { 160 | var jsonMessage = JSON.stringify(message); 161 | console.log('Senging message: ' + jsonMessage); 162 | ws.send(jsonMessage); 163 | } 164 | 165 | function showSpinner() { 166 | for (var i = 0; i < arguments.length; i++) { 167 | arguments[i].poster = './img/transparent-1px.png'; 168 | arguments[i].style.background = 'center transparent url("./img/spinner.gif") no-repeat'; 169 | } 170 | } 171 | 172 | function hideSpinner() { 173 | for (var i = 0; i < arguments.length; i++) { 174 | arguments[i].src = ''; 175 | arguments[i].poster = './img/webrtc.png'; 176 | arguments[i].style.background = ''; 177 | } 178 | } 179 | 180 | /** 181 | * Lightbox utility (to display media pipeline image in a modal dialog) 182 | */ 183 | $(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) { 184 | event.preventDefault(); 185 | $(this).ekkoLightbox(); 186 | }); 187 | --------------------------------------------------------------------------------