Skip to content

Commit

Permalink
Implements FMLE-compatible sequences.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Mar 26, 2024
1 parent b483971 commit ce872a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
14 changes: 13 additions & 1 deletion haishinkit/src/main/java/com/haishinkit/net/Responder.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
package com.haishinkit.net

import com.haishinkit.rtmp.RtmpConnection

/**
* A interface that response for a RTMPConnection.call().
* A interface that response for an [RtmpConnection].call().
*/
interface Responder {
fun onResult(arguments: List<Any?>)

fun onStatus(arguments: List<Any?>)

companion object {
val NULL = object : Responder {
override fun onResult(arguments: List<Any?>) {
}

override fun onStatus(arguments: List<Any?>) {
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ class RtmpConnection : EventDispatcher(null) {
}

internal fun createStream(stream: RtmpStream) {
stream.fcPublishName?.let {
// FMLE-compatible sequences
call("releaseStream", Responder.NULL, it)
call("FCPublish", Responder.NULL, it)
}
call(
"createStream",
object : Responder {
Expand Down
5 changes: 5 additions & 0 deletions haishinkit/src/main/java/com/haishinkit/rtmp/RtmpStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ class RtmpStream(context: Context, internal var connection: RtmpConnection) :
connection.doOutput(RtmpChunk.ZERO, message)
}

/**
* Specifies the stream name used for FMLE-compatible sequences.
*/
var fcPublishName: String? = null

@Volatile
var currentFPS: Int = 0
private set
Expand Down

0 comments on commit ce872a4

Please sign in to comment.