diff --git a/postman/ZLMediaKit.postman_collection.json b/postman/ZLMediaKit.postman_collection.json index 953c81b4..0d5e9837 100644 --- a/postman/ZLMediaKit.postman_collection.json +++ b/postman/ZLMediaKit.postman_collection.json @@ -2612,6 +2612,18 @@ "description": "是否循环点播mp4文件,如果配置文件已经开启循环点播,此参数无效", "disabled": true }, + { + "key": "seek_ms", + "value": "0", + "description": "点播seek到特定位置,单位毫秒", + "disabled": true + }, + { + "key": "speed", + "value": "1.0", + "description": "播放速度, float类型", + "disabled": true + }, { "key": "enable_hls", "value": "", diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 7d0dda9a..2c1ade7f 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -2251,6 +2251,19 @@ void installWebApi() { // sample_ms设置为0,从配置文件加载;file_repeat可以指定,如果配置文件也指定循环解复用,那么强制开启 [AUTO-TRANSLATED:23e826b4] // sample_ms is set to 0, loaded from the configuration file; file_repeat can be specified, if the configuration file also specifies loop demultiplexing, then force it to be enabled reader->startReadMP4(0, true, allArgs["file_repeat"]); + auto seek_ms = allArgs["seek_ms"].as(); + auto speed = allArgs["speed"].as(); + if (seek_ms || speed) { + auto p = static_pointer_cast(reader); + p->getOwnerPoller(MediaSource::NullMediaSource())->async([seek_ms, speed, p]() { + if (seek_ms) { + p->seekTo(MediaSource::NullMediaSource(), seek_ms); + } + if (speed && speed != 1.0) { + p->speed(MediaSource::NullMediaSource(), speed); + } + }); + } val["data"]["duration_ms"] = (Json::UInt64)reader->getDemuxer()->getDurationMS(); }); #endif