Skip to content
Open
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
193 changes: 183 additions & 10 deletions stream-video-android-core/api/stream-video-android-core.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ interface ProductvideoApi {
@Path("id") id: kotlin.String
): io.getstream.android.video.generated.models.SendCallEventResponse

/**
* Report HLS playback stats
* Reports HLS player lifecycle and playback stats for a viewer that join call sent to HLS playback
*/
@POST("/video/call/{type}/{id}/hls_stats")
suspend fun reportHLSStats(
@Path("type") type: kotlin.String,
@Path("id") id: kotlin.String,
@Body reportHLSStatsRequest: io.getstream.android.video.generated.models.ReportHLSStatsRequest
): io.getstream.android.video.generated.models.ReportHLSStatsResponse

/**
* Collect user feedback
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)

package io.getstream.android.video.generated.models

import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.*
import kotlin.io.*
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* A full snapshot of the HLS player's stats, so the latest report replaces earlier ones
*/

@JsonClass(generateAdapter = true)
data class HLSPlaybackStats (
@Json(name = "watch_duration_ms")
val watchDurationMs: kotlin.Long,

@Json(name = "stall_count")
val stallCount: kotlin.Int,

@Json(name = "stall_duration_ms")
val stallDurationMs: kotlin.Long,

@Json(name = "max_stall_duration_ms")
val maxStallDurationMs: kotlin.Long,

@Json(name = "dropped_frames")
val droppedFrames: kotlin.Int? = null,

@Json(name = "bitrate_kbps")
val bitrateKbps: kotlin.Int? = null,

@Json(name = "buffer_length_ms")
val bufferLengthMs: kotlin.Int? = null,

@Json(name = "live_latency_ms")
val liveLatencyMs: kotlin.Int? = null,

@Json(name = "width")
val width: kotlin.Int? = null,

@Json(name = "height")
val height: kotlin.Int? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)

package io.getstream.android.video.generated.models

import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.*
import kotlin.io.*
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* A discrete HLS player event (stall, quality switch, error)
*/

@JsonClass(generateAdapter = true)
data class HLSPlayerEvent (
@Json(name = "type")
val type: kotlin.String,

@Json(name = "timestamp")
val timestamp: kotlin.Long,

@Json(name = "data")
val data: kotlin.collections.Map<kotlin.String, kotlin.Any>? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ data class JoinCallRequest (
val prefer: Prefer? = null,

@Json(name = "playback_capabilities")
val playbackCapabilities: kotlin.collections.List<kotlin.String>? = emptyList()
val playbackCapabilities: kotlin.collections.List<kotlin.String>? = emptyList(),

@Json(name = "unified_session_id")
val unifiedSessionId: kotlin.String? = null
)
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ data class PlaybackResponse (
val reason: Reason,

@Json(name = "type")
val type: Type
val type: Type,

@Json(name = "stats_token")
val statsToken: kotlin.String? = null
)
{

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)

package io.getstream.android.video.generated.models

import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.*
import kotlin.io.*
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* A playback report from a viewer that join call sent to HLS playback
*/

@JsonClass(generateAdapter = true)
data class ReportHLSStatsRequest (
@Json(name = "stats_token")
val statsToken: kotlin.String,

@Json(name = "call_session_id")
val callSessionId: kotlin.String,

@Json(name = "user_session_id")
val userSessionId: kotlin.String,

@Json(name = "unified_session_id")
val unifiedSessionId: kotlin.String,

@Json(name = "type")
val type: kotlin.String,

@Json(name = "timestamp")
val timestamp: kotlin.Long,

@Json(name = "sdk")
val sdk: kotlin.String? = null,

@Json(name = "sdk_version")
val sdkVersion: kotlin.String? = null,

@Json(name = "os")
val os: kotlin.String? = null,

@Json(name = "os_version")
val osVersion: kotlin.String? = null,

@Json(name = "end_reason")
val endReason: kotlin.String? = null,

@Json(name = "error_code")
val errorCode: kotlin.String? = null,

@Json(name = "stats")
val stats: io.getstream.android.video.generated.models.HLSPlaybackStats? = null,

@Json(name = "events")
val events: kotlin.collections.List<io.getstream.android.video.generated.models.HLSPlayerEvent>? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2014-2026 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-video-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@file:Suppress(
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
)

package io.getstream.android.video.generated.models

import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.*
import kotlin.io.*
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

/**
* Basic response information
*/

@JsonClass(generateAdapter = true)
data class ReportHLSStatsResponse (
@Json(name = "duration")
val duration: kotlin.String
)
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@ data class StatsOptions (
val enableRtcStats: kotlin.Boolean,

@Json(name = "reporting_interval_ms")
val reportingIntervalMs: kotlin.Int
val reportingIntervalMs: kotlin.Int,

@Json(name = "enable_hls_stats")
val enableHlsStats: kotlin.Boolean? = null,

@Json(name = "reporting_hls_interval_ms")
val reportingHlsIntervalMs: kotlin.Int? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ import io.getstream.video.android.core.call.components.NoiseCancellationPolicy
import io.getstream.video.android.core.call.components.RtcSessionFactory
import io.getstream.video.android.core.call.components.SessionMonitor
import io.getstream.video.android.core.call.connection.StreamPeerConnectionFactory
import io.getstream.video.android.core.call.hls.CoordinatorHlsStatsDelivery
import io.getstream.video.android.core.call.hls.HlsPlayer
import io.getstream.video.android.core.call.hls.HlsStatsConfig
import io.getstream.video.android.core.call.hls.HlsStatsReporter
import io.getstream.video.android.core.call.scope.ScopeProvider
import io.getstream.video.android.core.call.scope.ScopeProviderImpl
import io.getstream.video.android.core.call.video.VideoFilter
Expand Down Expand Up @@ -570,6 +573,17 @@ public class Call(
}
}
},
createHlsStatsReporter = { player, joinResponse ->
HlsStatsConfig.from(joinResponse, sessionManager.unifiedSessionId)?.let { config ->
HlsStatsReporter(
config = config,
player = player,
delivery = CoordinatorHlsStatsDelivery(clientImpl, type, id),
// The ended report outlives the call scope, which leave cancels.
scope = clientImpl.scope,
)
}
},
)

internal var reconnectDeadlineMillis: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import io.getstream.android.video.generated.models.QueryCallMembersResponse
import io.getstream.android.video.generated.models.QueryCallsRequest
import io.getstream.android.video.generated.models.RejectCallRequest
import io.getstream.android.video.generated.models.RejectCallResponse
import io.getstream.android.video.generated.models.ReportHLSStatsRequest
import io.getstream.android.video.generated.models.ReportHLSStatsResponse
import io.getstream.android.video.generated.models.RequestPermissionRequest
import io.getstream.android.video.generated.models.RingCallRequest
import io.getstream.android.video.generated.models.RingCallResponse
Expand Down Expand Up @@ -868,6 +870,7 @@ internal class StreamVideoClient internal constructor(
hintHighScaleLivestreamPublisher: Boolean? = null,
e2ee: Boolean? = null,
playbackCapabilities: List<String>? = null,
unifiedSessionId: String? = null,
): Result<JoinCallResponse> {
val joinCallRequest = JoinCallRequest(
create = create,
Expand All @@ -886,6 +889,7 @@ internal class StreamVideoClient internal constructor(
migratingFromList = migratingFromList,
hintHighScaleLivestreamPublisher = hintHighScaleLivestreamPublisher,
playbackCapabilities = playbackCapabilities,
unifiedSessionId = unifiedSessionId,
)

val result = apiCall {
Expand All @@ -899,6 +903,18 @@ internal class StreamVideoClient internal constructor(
return result
}

suspend fun reportHlsStats(
type: String,
id: String,
request: ReportHLSStatsRequest,
): Result<ReportHLSStatsResponse> = apiCall {
coordinatorConnectionModule.api.reportHLSStats(
type = type,
id = id,
reportHLSStatsRequest = request,
)
}

suspend fun updateMembers(
type: String,
id: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ internal class CallApiClient(
hintHighScaleLivestreamPublisher = hintHighScaleLivestreamPublisher,
e2ee = requestE2ee,
playbackCapabilities = playbackCapabilities,
unifiedSessionId = sessionManager.unifiedSessionId,
)
result.onSuccess {
callAnalytics.joinAnalytics.onJoinRequestSuccess(
Expand Down
Loading
Loading