Browse Source

Examples: Renamed media to media-receiver

Paul-Louis Ageneau 3 years ago
parent
commit
476d23c890

+ 1 - 1
CMakeLists.txt

@@ -472,7 +472,7 @@ if(NOT NO_EXAMPLES)
 		add_subdirectory(examples/client-benchmark)
 		add_subdirectory(examples/client-benchmark)
 	endif()
 	endif()
 	if(NOT NO_MEDIA)
 	if(NOT NO_MEDIA)
-		add_subdirectory(examples/media)
+		add_subdirectory(examples/media-receiver)
 		add_subdirectory(examples/sfu-media)
 		add_subdirectory(examples/sfu-media)
 	endif()
 	endif()
 	if(NOT NO_MEDIA AND NOT NO_WEBSOCKET)
 	if(NOT NO_MEDIA AND NOT NO_WEBSOCKET)

+ 1 - 1
examples/README.md

@@ -9,7 +9,7 @@ This directory contains different WebRTC clients and compatible WebSocket + JSON
 - [signaling-server-python](signaling-server-python) contains a similar signaling server in Python
 - [signaling-server-python](signaling-server-python) contains a similar signaling server in Python
 - [signaling-server-rust](signaling-server-rust) contains a similar signaling server in Rust (see [lerouxrgd/datachannel-rs](https://github.com/lerouxrgd/datachannel-rs) for Rust wrappers)
 - [signaling-server-rust](signaling-server-rust) contains a similar signaling server in Rust (see [lerouxrgd/datachannel-rs](https://github.com/lerouxrgd/datachannel-rs) for Rust wrappers)
 
 
-- [media](media) is a copy/paste demo to send the webcam from your browser into gstreamer.
+- [media-receiver](media-receiver) is a copy/paste demo to send the webcam from your browser receive it into gstreamer.
 - [sfu-media](sfu-media) is a copy/paste SFU demo to relay the webcam between browsers.
 - [sfu-media](sfu-media) is a copy/paste SFU demo to relay the webcam between browsers.
 - [streamer](streamer) streams h264 and opus samples to web browsers (signaling-server-python is required).
 - [streamer](streamer) streams h264 and opus samples to web browsers (signaling-server-python is required).
 
 

+ 35 - 0
examples/media-receiver/CMakeLists.txt

@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(MEDIA_UWP_RESOURCES
+	uwp/Logo.png
+	uwp/package.appxManifest
+	uwp/SmallLogo.png
+	uwp/SmallLogo44x44.png
+	uwp/SplashScreen.png
+	uwp/StoreLogo.png
+	uwp/Windows_TemporaryKey.pfx
+)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+	add_executable(datachannel-media-receiver main.cpp ${MEDIA_UWP_RESOURCES})
+else()
+	add_executable(datachannel-media-receiver main.cpp)
+endif()
+
+set_target_properties(datachannel-media-receiver PROPERTIES
+    CXX_STANDARD 17
+    OUTPUT_NAME media-receiver)
+
+set_target_properties(datachannel-media-receiver PROPERTIES
+	XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.github.paullouisageneau.libdatachannel.examples.media-receiver)
+
+find_package(Threads REQUIRED)
+target_link_libraries(datachannel-media-receiver LibDataChannel::LibDataChannel Threads::Threads nlohmann_json)
+
+if(MSVC)
+	add_custom_command(TARGET datachannel-media-receiver POST_BUILD
+		COMMAND ${CMAKE_COMMAND} -E copy_if_different
+		"$<TARGET_FILE_DIR:datachannel>/datachannel.dll"
+		$<TARGET_FILE_DIR:datachannel-media-receiver>
+	)
+endif()

+ 0 - 0
examples/media/README.md → examples/media-receiver/README.md


+ 5 - 2
examples/media/main.cpp → examples/media-receiver/main.cpp

@@ -1,5 +1,5 @@
 /*
 /*
- * libdatachannel media example
+ * libdatachannel media receiver example
  * Copyright (c) 2020 Staz Modrzynski
  * Copyright (c) 2020 Staz Modrzynski
  * Copyright (c) 2020 Paul-Louis Ageneau
  * Copyright (c) 2020 Paul-Louis Ageneau
  *
  *
@@ -85,12 +85,15 @@ int main() {
 		std::cout << "Please copy/paste the answer provided by the browser: " << std::endl;
 		std::cout << "Please copy/paste the answer provided by the browser: " << std::endl;
 		std::string sdp;
 		std::string sdp;
 		std::getline(std::cin, sdp);
 		std::getline(std::cin, sdp);
+
 		std::cout << "Got answer" << sdp << std::endl;
 		std::cout << "Got answer" << sdp << std::endl;
 		json j = json::parse(sdp);
 		json j = json::parse(sdp);
 		rtc::Description answer(j["sdp"].get<std::string>(), j["type"].get<std::string>());
 		rtc::Description answer(j["sdp"].get<std::string>(), j["type"].get<std::string>());
 		pc->setRemoteDescription(answer);
 		pc->setRemoteDescription(answer);
+
 		std::cout << "Press any key to exit." << std::endl;
 		std::cout << "Press any key to exit." << std::endl;
-		std::cin >> sdp;
+		char dummy;
+		std::cin >> dummy;
 
 
 	} catch (const std::exception &e) {
 	} catch (const std::exception &e) {
 		std::cerr << "Error: " << e.what() << std::endl;
 		std::cerr << "Error: " << e.what() << std::endl;

+ 4 - 4
examples/media/main.html → examples/media-receiver/main.html

@@ -2,11 +2,11 @@
 <html lang="en">
 <html lang="en">
 <head>
 <head>
     <meta charset="UTF-8">
     <meta charset="UTF-8">
-    <title>libdatachannel media example</title>
+    <title>libdatachannel media receiver example</title>
 </head>
 </head>
 <body>
 <body>
 
 
-<p>Please enter the offer provided to you by the application: </p>
+<p>Please enter the offer provided to you by the receiver application: </p>
 <textarea cols="50" rows="50"></textarea>
 <textarea cols="50" rows="50"></textarea>
 <button>Submit</button>
 <button>Submit</button>
 
 
@@ -23,8 +23,8 @@
                 // We only want to provide an answer once all of our candidates have been added to the SDP.
                 // We only want to provide an answer once all of our candidates have been added to the SDP.
                 let answer = rtc.localDescription;
                 let answer = rtc.localDescription;
                 document.querySelector('textarea').value = JSON.stringify({"type": answer.type, sdp: answer.sdp});
                 document.querySelector('textarea').value = JSON.stringify({"type": answer.type, sdp: answer.sdp});
-                document.querySelector('p').value = 'Please paste the answer in the application.';
-                alert('Please paste the answer in the application.');
+                document.querySelector('p').value = 'Please paste the answer in the receiver application.';
+                alert('Please paste the answer in the receiver application.');
             }
             }
         }
         }
         await rtc.setRemoteDescription(offer);
         await rtc.setRemoteDescription(offer);

+ 0 - 0
examples/media/uwp/Logo.png → examples/media-receiver/uwp/Logo.png


+ 0 - 0
examples/media/uwp/SmallLogo.png → examples/media-receiver/uwp/SmallLogo.png


+ 0 - 0
examples/media/uwp/SmallLogo44x44.png → examples/media-receiver/uwp/SmallLogo44x44.png


+ 0 - 0
examples/media/uwp/SplashScreen.png → examples/media-receiver/uwp/SplashScreen.png


+ 0 - 0
examples/media/uwp/StoreLogo.png → examples/media-receiver/uwp/StoreLogo.png


+ 0 - 0
examples/media/uwp/Windows_TemporaryKey.pfx → examples/media-receiver/uwp/Windows_TemporaryKey.pfx


+ 0 - 0
examples/media/uwp/package.appxManifest → examples/media-receiver/uwp/package.appxManifest


+ 0 - 35
examples/media/CMakeLists.txt

@@ -1,35 +0,0 @@
-cmake_minimum_required(VERSION 3.7)
-
-set(MEDIA_UWP_RESOURCES
-	uwp/Logo.png
-	uwp/package.appxManifest
-	uwp/SmallLogo.png
-	uwp/SmallLogo44x44.png
-	uwp/SplashScreen.png
-	uwp/StoreLogo.png
-	uwp/Windows_TemporaryKey.pfx
-)
-
-if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
-	add_executable(datachannel-media main.cpp ${MEDIA_UWP_RESOURCES})
-else()
-	add_executable(datachannel-media main.cpp)
-endif()
-
-set_target_properties(datachannel-media PROPERTIES
-    CXX_STANDARD 17
-    OUTPUT_NAME media)
-
-set_target_properties(datachannel-media PROPERTIES
-	XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.github.paullouisageneau.libdatachannel.examples.media)
-
-find_package(Threads REQUIRED)
-target_link_libraries(datachannel-media LibDataChannel::LibDataChannel Threads::Threads nlohmann_json)
-
-if(MSVC)
-	add_custom_command(TARGET datachannel-media POST_BUILD
-		COMMAND ${CMAKE_COMMAND} -E copy_if_different
-		"$<TARGET_FILE_DIR:datachannel>/datachannel.dll"
-		$<TARGET_FILE_DIR:datachannel-media>
-	)
-endif()