我已经在 DirectLine 频道中发布了我的机器人。我正在使用“视频卡”来播放视频(基本上来自 youtube)在聊天窗口中播放。当我尝试在视频聊天窗口中播放视频(youtube)时,我发现视频卡中没有启用全屏选项,视频正在播放但无法以全屏模式打开。当我尝试单击全屏选项时,它显示“全屏不可用”。
这是调用视频卡的代码片段。
if (youtubepath[0].file_type == "video")
{
reply.Attachments.Add(GetVideoCard(name.ToUpperInvariant(), "https://www.youtube.com/watch?v=" + youtubepath[0].youtube_id.ToString()).ToAttachment());
}
显卡
public static VideoCard GetVideoCard(string name, string youtubepath)
{
string baseurl = "";
var videoCard = new VideoCard
{
Title = name,
Media = new List<MediaUrl>
{
new MediaUrl()
{
Url =baseurl + youtubepath,
},
},
};
return videoCard;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.botframework.com/botframework-webchat/latest/botchat.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="botabc">
<script src="https://cdn.botframework.com/botframework-webchat/latest/botchat.js"></script>
<script src="CognitiveServices.js"></script>
<script>
const store = window.WebChat.createStore({},({ dispatch }) => next => action =>{if (action.type === 'DIRECT_LINE/POST_ACTIVITY_FULFILLED'){document.querySelector('ul[role="list"]').lastChild.scrollIntoView({behavior: 'smooth', block: 'start'});}return next(action);});
window.WebChat.renderWebChat({directLine: window.WebChat.createDirectLine({ secret: 'xxxx' }),store}, document.getElementById('webchat'));
</script>
<script>
const params = BotChat.queryParams(location.search);
const speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({ subscriptionKey: 'xxxx' }),
speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
gender: CognitiveServices.SynthesisGender.Female,
subscriptionKey: 'xxxx',
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US,JessaRUS)'
})
};
BotChat.App({
resize: 'detect',
speechOptions: speechOptions,
user: {id:'1',name:'Bhakt'},
directLine: { secret: 'xxxx' },
bot: { id: 'botid' },
resize: 'detect'},
document.getElementById("botabc"));
</script>
</body>
</html>
建议我解决这个问题的方法。
提前致谢!!