Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/.vitepress/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PROJECT_VARS } from './versions'

export const navbar: DefaultTheme.NavItem[] = [
{
text: 'Guide',
text: 'Docs',
link: '/guide/',
},
{
Expand All @@ -15,6 +15,10 @@ export const navbar: DefaultTheme.NavItem[] = [
text: 'Tools',
link: '/tools',
},
{
text: 'Client API Design',
link: '/guide/client-api-design',
},
{
text: IS_NEXT ? PROJECT_VARS.VERSION_SNAPSHOT : PROJECT_VARS.VERSION,
items: [
Expand All @@ -38,4 +42,4 @@ export const navbar: DefaultTheme.NavItem[] = [
}
]
}
]
]
1 change: 1 addition & 0 deletions docs/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function sidebarGuide(): DefaultTheme.SidebarItem[] {
{ text: 'What is webrtc-java?', link: '/introduction' },
{ text: 'Getting Started', link: '/get-started' },
{ text: 'Client API', link: '/client-api' },
{ text: 'Client API Design', link: '/client-api-design' },
],
},
{
Expand Down
130 changes: 130 additions & 0 deletions docs/.vitepress/theme/DocsHome.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
import { withBase } from 'vitepress'
import { PROJECT_VARS } from '../versions'
import NextBanner from './NextBanner.vue'
import DocsIcon from './DocsIcon.vue'

const tab = ref('client')
const copied = ref(false)
const copyFailed = ref(false)
const platforms = [
{ classifier: 'windows-x86_64', label: 'Windows · x64' },
{ classifier: 'windows-aarch64', label: 'Windows · ARM64' },
{ classifier: 'macos-x86_64', label: 'macOS · Intel' },
{ classifier: 'macos-aarch64', label: 'macOS · Apple Silicon' },
{ classifier: 'linux-x86_64', label: 'Linux · x64' },
{ classifier: 'linux-aarch64', label: 'Linux · ARM64' },
{ classifier: 'linux-aarch32', label: 'Linux · ARM32' },
]
const platform = ref(platforms[0].classifier)
const dependency = computed(() => `<dependency>
<groupId>dev.onvoid.webrtc</groupId>
<artifactId>webrtc-java</artifactId>
<version>${PROJECT_VARS.VERSION}</version>
</dependency>

<dependency>
<groupId>dev.onvoid.webrtc</groupId>
<artifactId>webrtc-java</artifactId>
<version>${PROJECT_VARS.VERSION}</version>
<classifier>${platform.value}</classifier>
<scope>runtime</scope>
</dependency>`)
const gradleDependency = computed(() => `dependencies {
implementation("dev.onvoid.webrtc:webrtc-java:${PROJECT_VARS.VERSION}")
runtimeOnly("dev.onvoid.webrtc:webrtc-java:${PROJECT_VARS.VERSION}:${platform.value}")
}`)
const displayedDependency = computed(() => tab.value === 'gradle' ? gradleDependency.value : dependency.value)
watch([tab, platform], () => {
copied.value = false
copyFailed.value = false
})
async function copyDependency() {
try {
await navigator.clipboard.writeText(displayedDependency.value)
copied.value = true
copyFailed.value = false
setTimeout(() => { copied.value = false }, 2000)
} catch { copyFailed.value = true }
}
const paths = [
{ label: 'START BUILDING', title: 'Your first connection', description: 'Install the library, connect two peers, and send your first audio and video.', link: '/guide/get-started', action: 'Get started', icon: 'code' },
{ label: 'EXPLORE MEDIA', title: 'Bring your media', description: 'Capture a camera, share a screen, play an RTSP stream, or record a call.', link: '/guide/media/media-devices', action: 'Explore media', icon: 'video' },
{ label: 'CONNECT TO MEDIA SERVERS', title: 'WHIP / WHEP', description: 'Publish live audio and video with WHIP, or receive streams with WHEP over HTTP.', link: '/guide/client-api#whip-and-whep', action: 'Explore WHIP / WHEP', icon: 'arrows' },
]
const topics = [
{ title: 'Audio & video capture', detail: 'Connect microphones, cameras, and custom sources.', link: '/guide/media/media-devices', icon: 'video' },
{ title: 'Screen sharing', detail: 'From a window to the whole desktop.', link: '/guide/video/desktop-capture', icon: 'monitor' },
{ title: 'Data channels', detail: 'Reliable or unreliable messaging and file transfer.', link: '/guide/data/data-channels', icon: 'arrows' },
{ title: 'Hardware codecs', detail: 'GPU encoding and decoding, with software fallback.', link: '/guide/advanced/video-codecs#hardware-encoding', icon: 'zap' },
{ title: 'Custom video codecs', detail: 'Plug your own Java encoders and decoders into WebRTC.', link: '/guide/advanced/video-codecs#adding-a-codec', icon: 'code' },
{ title: 'Video processing', detail: 'Transform camera and desktop frames before sending.', link: '/guide/video/camera-capture#changing-frames-before-they-are-sent', icon: 'sliders' },
{ title: 'End-to-end encryption', detail: 'Build frame encryption with encoded transforms.', link: '/guide/advanced/encoded-transforms', icon: 'lock' },
{ title: 'Pre-encoded media', detail: 'Send encoded frames without encoding them again.', link: '/guide/advanced/encoded-transforms#injecting-encoded-frames', icon: 'send' },
{ title: 'Media playback', detail: 'Play media files and live RTSP streams into a call.', link: '/guide/media/media-files', icon: 'play' },
{ title: 'Call recording', detail: 'Save sent and received media without re-encoding.', link: '/guide/media/media-recording', icon: 'record' },
{ title: 'Audio processing', detail: 'Echo cancellation, noise suppression, and gain control.', link: '/guide/audio/audio-processing', icon: 'audio' },
{ title: 'Statistics & monitoring', detail: 'Track bitrate, packet loss, jitter, and round-trip time.', link: '/guide/monitoring/rtc-stats', icon: 'activity' },
]
</script>

<template>
<div class="docs-home">
<NextBanner />
<section class="dh-hero" aria-labelledby="hero-title">
<div class="dh-intro">
<h1 id="hero-title">Real-time.<br>Native.<br><span>Made for Java.</span></h1>
<p class="dh-lead">Audio, video, and data for your desktop applications. The power of WebRTC, with a Java API that feels like home.</p>
<div class="dh-actions"><a class="dh-primary" :href="withBase('/guide/get-started')">Start building</a><a class="dh-secondary" :href="withBase('/guide/examples')">Explore examples <DocsIcon name="arrow-up-right" /></a></div>
<div class="dh-platforms"><span>ONE API. THREE PLATFORMS.</span><div>Windows <i>·</i> macOS <i>·</i> Linux</div></div>
</div>
<div class="dh-code-area">
<div class="dh-code-window">
<div class="dh-code-title"><span><i></i><i></i><i></i></span><span class="dh-file-type">{{ tab === 'client' ? 'JAVA' : tab === 'maven' ? 'XML' : 'GRADLE' }}</span></div>
<div class="dh-code-tabs" role="group" aria-label="Code example"><button :class="{ active: tab === 'client' }" :aria-pressed="tab === 'client'" @click="tab = 'client'">Client API</button><button :class="{ active: tab === 'maven' }" :aria-pressed="tab === 'maven'" @click="tab = 'maven'">Maven dependency</button><button :class="{ active: tab === 'gradle' }" :aria-pressed="tab === 'gradle'" @click="tab = 'gradle'">Gradle</button></div>
<pre v-if="tab === 'client'" class="dh-code"><code><span class="comment">// Your media. Connected.</span>
<span class="keyword">try</span> (<span class="type">WebRtc</span> rtc = <span class="type">WebRtc</span>.create()) {
<span class="type">Peer</span> peer = rtc.createPeer(
<span class="type">PeerOptions</span>.builder()
.polite(<span class="keyword">true</span>)
.signaling(message -&gt;
socket.send(message.toJson()))
.build());

socket.onText(text -&gt; peer.signal(
<span class="type">SignalMessage</span>.fromJson(text)));

peer.addTrack(rtc.media().microphone());
peer.addTrack(rtc.media().camera());

peer.whenConnected().join();
hangUp.await();
} <span class="comment">// Everything closes with the runtime.</span></code></pre>
<div v-else class="dh-maven">
<pre class="dh-code"><code>{{ displayedDependency }}</code></pre>
<div class="dh-copy-row">
<button class="dh-copy" @click="copyDependency">{{ copied ? 'Copied ✓' : 'Copy dependencies' }}</button>
<select id="native-platform" class="dh-platform-select" aria-label="Native platform" v-model="platform">
<option v-for="option in platforms" :key="option.classifier" :value="option.classifier">{{ option.label }}</option>
</select>
<span v-if="copyFailed" role="status">Select the dependencies above to copy them manually.</span>
</div>
</div>
<div class="dh-code-footer"><span><span class="dh-dot"></span> {{ tab === 'client' ? 'Excerpt · bring your signaling transport' : `Release ${PROJECT_VARS.VERSION}` }}</span></div>
</div>
<div class="dh-code-caption"><span>Less plumbing. More building.</span> Lifecycle and negotiation, handled.</div>
</div>
</section>

<div class="dh-capabilities"><span><b>JNI</b> Native performance</span><span><DocsIcon name="arrows" /> Peer-to-peer connections</span><span><DocsIcon name="shield" /> Open source · Apache 2.0</span><a :href="withBase('/guide/client-api')">Meet the Client API <DocsIcon name="arrow-right" /></a></div>

<section class="dh-section" aria-labelledby="path-title">
<div class="dh-section-heading"><div><h2 id="path-title">Find your starting point.</h2></div><a :href="withBase('/guide/')">Browse all guides <DocsIcon name="arrow-up-right" /></a></div>
<div class="dh-paths"><a v-for="path in paths" :key="path.link" class="dh-path" :href="withBase(path.link)"><div class="dh-path-top"><span class="dh-path-icon"><DocsIcon :name="path.icon" /></span></div><div class="dh-eyebrow">{{ path.label }}</div><h3>{{ path.title }}</h3><p>{{ path.description }}</p><div class="dh-path-action">{{ path.action }}</div></a></div>
</section>

<section class="dh-section dh-topics" aria-labelledby="topics-title"><div class="dh-section-heading"><div><h2 id="topics-title">What will you connect?</h2></div><span class="dh-muted">From the first frame to the last packet.</span></div><div class="dh-topic-grid"><a v-for="topic in topics" :key="topic.title" :href="withBase(topic.link)"><span class="dh-topic-icon"><DocsIcon :name="topic.icon" /></span><div><h3>{{ topic.title }}</h3><p>{{ topic.detail }}</p></div><DocsIcon class="dh-topic-arrow" name="arrow-up-right" /></a></div></section>
<footer class="dh-footer"><span>webrtc-java <span class="dh-muted">/ Real-time starts here.</span></span><div><a :href="withBase('/guide/build')">Build from source</a><a href="https://javadoc.io/doc/dev.onvoid.webrtc/webrtc-java/latest/index.html">JavaDoc <DocsIcon name="arrow-up-right" /></a></div></footer>
</div>
</template>
27 changes: 27 additions & 0 deletions docs/.vitepress/theme/DocsIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script setup lang="ts">
// Lucide icons (ISC), matching the documentation's original feature icons.
defineProps<{ name: string }>()
const paths: Record<string, string[]> = {
'arrow-up-right': ['M7 17 17 7', 'M7 7h10v10'],
'arrow-right': ['M5 12h14', 'm12 5 7 7-7 7'],
video: ['m16 10 5-3v10l-5-3', 'M4 6h10a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2Z'],
monitor: ['M4 3h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z', 'M8 21h8M12 17v4'],
arrows: ['m8 3-4 4 4 4M4 7h16', 'm16 21 4-4-4-4M20 17H4'],
zap: ['m13 2-10 12h9l-1 8 10-12h-9l1-8Z'],
code: ['m16 18 6-6-6-6M8 6l-6 6 6 6'],
sliders: ['M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3', 'M14 2v4M8 10v4M16 18v4'],
lock: ['M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2Z', 'M7 11V7a5 5 0 0 1 10 0v4'],
send: ['m22 2-7 20-4-9-9-4 20-7Z', 'M22 2 11 13'],
play: ['M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z', 'm10 8 6 4-6 4V8Z'],
record: ['M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z', 'M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z'],
audio: ['M2 10v4M6 6v12M10 3v18M14 8v8M18 5v14M22 10v4'],
activity: ['M22 12h-4l-3 9L9 3l-3 9H2'],
shield: ['M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z'],
}
</script>

<template>
<svg class="dh-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path v-for="(path, index) in paths[name]" :key="index" :d="path" />
</svg>
</template>
Loading
Loading