此问题的解决方案可能涉及Amazon Web Services(AWS) MediaLive API的更改。以下是一些可能的解决方法之一。
确保您有正确的时间设置。如果您的MediaLive管道参数设置不正确,Schedule Input Switch可能会出现不按预期工作的情况。您可以检查与节目月份和日期相关的参数,例如program_timing_configuration和timed_metadata_insertion的参数设置。
您可能需要重写您的AWS Lambda函数,并使用AWS CLI或AWS SDK for Python(Boto3)来更新您的MediaLive管道的Schedule Input Switch。以下是一个例子,使用Boto3库:
import boto3
medialive = boto3.client('medialive')
response = medialive.update_schedule(scheduleActions=[
{
'ActionName': 'InputSwitch',
'ScheduleActionSettings': {
'InputSwitchSettings': {
'InputAttachmentNameReference': 'string',
'InputClippingSettings': {
'InputTimecodeSource': 'ZEROBASED'|'EMBEDDED',
'StartTimecode': {
'Timecode': 'string'
},
'StopTimecode': {
'Timecode': 'string'
}
},
'UrlPath': 'string'
}
},
'ScheduleActionStartSettings': {
'FixedModeScheduleActionStartSettings': {
'Time': 'string'
}
}
}
],
ChannelId='string'
)
在代码中,您可以设置mediaLive对象的管道ID,以及用于调度Input Switch的参数。在这个例子中,我们使用了InputAttachmentNameReference和UrlPath参数来设置input切换所需的名称和路径。
如果您的代码仍然无法按预期工作,您可以审查AWS CloudWatch日志文件以查找问题。您可以通过使用AWS SDK 访问日志,例如boto3库。
import boto3
import json
client = boto3.client('logs')
LOG_GROUP = 'string'
LOG_STREAM = 'string'
def get_log_events():
response = client.get_log_events(
logGroupName=LOG_GROUP,
logStreamName=LOG_STREAM,
startFromHead=True
)
events = [
json.loads(event['message'])
for event in response.get('events', [])
]
return events
您可以使用这个例