fix: trigger approaching broadcast under 30 seconds
This commit is contained in:
+19
-8
@@ -1866,8 +1866,9 @@ function handleTrainApproaching(ws, data) {
|
||||
const finalPlatform = cleanPlatform || '1';
|
||||
|
||||
const destCode = data.destCode || getStationCodeFromName(data.destination) || 'UNK';
|
||||
const delay = Number(data.delay) || 0; // 获取延误信息(分钟)
|
||||
|
||||
log('INFO', `Train ${trainId} approaching ${stationName}. Broadcasting pre-arrival...`);
|
||||
log('INFO', `Train ${trainId} approaching ${stationName} (Delay: ${delay} min). Broadcasting pre-arrival...`);
|
||||
|
||||
ws.send(JSON.stringify({
|
||||
type: 'train_approaching_ack',
|
||||
@@ -1880,11 +1881,21 @@ function handleTrainApproaching(ws, data) {
|
||||
// 提示音:ksts
|
||||
// 日文:ja-fc1 + ja-站台编号 + ja-fc2 + ja-终点编号 + ja-fc3
|
||||
// 中文:ch-fc1 + ch-fc2 + ch-fc3 + ch-终点编号 + ch-fc4
|
||||
const seq = [
|
||||
'ksts',
|
||||
'ja-fc1', `ja-${finalPlatform}`, 'ja-fc2', `ja-${destCode}`, 'ja-fc3',
|
||||
'ch-fc1', 'ch-fc2', 'ch-fc3', `ch-${destCode}`, 'ch-fc4'
|
||||
];
|
||||
const seq = ['ksts'];
|
||||
|
||||
// 拼接日文
|
||||
seq.push('ja-fc1', `ja-${finalPlatform}`, 'ja-fc2', `ja-${destCode}`, 'ja-fc3');
|
||||
if (delay > 0) {
|
||||
// TODO: 根据用户的延误音频设计在这里插入日文延误播报
|
||||
// 例如: seq.push('ja-delay-prefix', `ja-${delay}`, 'ja-delay-suffix');
|
||||
}
|
||||
|
||||
// 拼接中文
|
||||
seq.push('ch-fc1', 'ch-fc2', 'ch-fc3', `ch-${destCode}`, 'ch-fc4');
|
||||
if (delay > 0) {
|
||||
// TODO: 根据用户的延误音频设计在这里插入中文延误播报
|
||||
// 例如: seq.push('ch-delay-prefix', `ch-${delay}`, 'ch-delay-suffix');
|
||||
}
|
||||
|
||||
enqueueHlsPush(stationName, seq);
|
||||
|
||||
@@ -1896,8 +1907,8 @@ function handleTrainApproaching(ws, data) {
|
||||
sourcePath: built.sourcePath,
|
||||
streamUrl: built.streamUrl,
|
||||
durationSec: built.durationSec,
|
||||
priority: 1,
|
||||
interruptMode: 'ifLower',
|
||||
priority: 0,
|
||||
interruptMode: 'none',
|
||||
source: 'train_approaching',
|
||||
audioId,
|
||||
consoleStreamStart: { type: 'stream_start', station: stationName, seq, streamName: getStationStreamName(stationName), hlsUrl: getStationHlsUrl(getStationStreamName(stationName)) },
|
||||
|
||||
Reference in New Issue
Block a user