【问题标题】:Embed Microsoft Stream to Task Module Microsoft Teams将 Microsoft Stream 嵌入到任务模块 Microsoft Teams
【发布时间】:2021-07-22 10:45:53
【问题描述】:

以前我可以使用任务模块和 iframe 将 youtube 嵌入到 Microsoft 团队的 Adaptive Card 中,但我知道 Microsoft Stream 没有向公众分享视频的功能。因此,当 URL 视频设置为 Microsoft Stream Video 时,Iframe 将显示“登录和登录页面”,当单击该标志时,它会打开一个新浏览器。我想在 Microsoft 团队任务模块中播放视频,我认为它已经使用 SSO 并且不需要任何标志。 这是任务模块的截图

这是我的 iframe 页面源代码

import React, { Component } from 'react';
import './SeeDetail.css';
import * as microsoftTeams from "@microsoft/teams-js";
import i18n from '../../i18n';
import { getUrlVideo } from '../../apis/messageListApi';
import axios, { AxiosResponse, AxiosRequestConfig } from "axios";

export default class SeeDetail extends Component {

    constructor(props) {
        super(props);
        this.state = {
            video: ""
        }
    }

    async componentDidMount() {
        microsoftTeams.initialize();

        const video = this.getQueryVariable('video');





        const authTokenRequest = {
            url: window.location.origin + "/signin-simple-start",
            successCallback: (token) => {

                this.setState({ video: video });

            },
            failureCallback: (error) => {
                // When the getAuthToken function returns a "resourceRequiresConsent" error, 
                // it means Azure AD needs the user's consent before issuing a token to the app. 
                // The following code redirects the user to the "Sign in" page where the user can grant the consent. 
                // Right now, the app redirects to the consent page for any error.

                microsoftTeams.authentication.authenticate({
                    url: window.location.origin + "/signin-simple-start",
                    successCallback: () => {
                        console.log("Login succeeded!");

                        this.setState({ video: video });
                    },
                    failureCallback: (reason) => {
                        console.log("Login failed: " + reason);
                        window.location.href = `/errorpage?locale=${i18n.language}`;
                    }
                });
            },
            resources: []

        };

        microsoftTeams.authentication.getAuthToken(authTokenRequest);




    }


    getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        console.log(query)//"app=article&act=news_content&aid=160990"
        var vars = query.split("&");
        console.log(vars) //[ 'app=article', 'act=news_content', 'aid=160990' ]
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            console.log(pair)//[ 'app', 'article' ][ 'act', 'news_content' ][ 'aid', '160990' ] 
            if (pair[0] == variable) { return pair[1]; }
        }
        return (false);
    }

    render() {
        return (
            <div className="container" >

                <iframe id="my_iframe" src={this.state.video} className="responsive-iframe" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="allowfullscreen"></iframe>
            </div>


        )
    }
}

我不知道是否可以在任务模块中观看 Microsoft Stream。也许我错过了登录方法?我以为 Sign-in 方法只适用于 Axios 调用。

【问题讨论】:

  • 您是否在清单中的有效域中添加了 Microsoft 流 url?
  • 好吧,让我先添加它,但它应该正确显示您是否曾经使用 Microsoft 流作为任务模块的 iframe 内容。我仍然不确定这是否可以完成,因为我在这里找不到任何文件。甚至团队的默认流功能也会重定向到新浏览器
  • @Mamatha-MSFT 我已经有这两个域 companycommunicatorkre.azurefd.net, microsoftstream.com 但仍然没有什么不同。 Microsoft Stream 仍需要身份验证
  • @Mamatha-MSFT 嗨,用更新的代码更新我的问题,你知道为什么我收到“未找到定义”错误,错误的含义是什么?

标签: javascript reactjs stream microsoft-teams


【解决方案1】:

您不能让 SSO 为您不拥有的应用程序工作。如果您的机器人具有应用程序 A 的 SSO 凭据,则您无法打开应用程序 B 并期望 SSO 正常工作。我们对每个应用清单的一个 SSO 凭据有限制。您可以在选项卡中添加 Microsoft 流视频,但如果您在任务模块中添加流视频,它将显示登录选项,这是设计使然。

【讨论】:

  • 您好,感谢您的回答,我现在使用 msteams 身份验证,使用弹出登录,但现在我遇到了移动客户端问题,登录弹出窗口不显示。我正在使用 ms 团队 1.90 版,它是最新版本。
  • 嗨 @Mamatha-MSFT 我现在更新了我的代码,这适用于桌面版本,但不适用于移动版本
  • 我现在发现了错误,无法获取身份验证令牌。 “该应用既没有列入白名单,也没有资源与当前域匹配”这是移动版本的错误。
  • 您是否在清单中提供了"webApplicationInfo": { "id": "00000000-0000-0000-0000-000000000000", "resource": "api://subdomain.example.com/00000000-0000-0000-0000-000000000000" }?以及支持 SSO for Android(1416/1.0.0.2020073101 及更高版本)和 Teams for iOS(版本:2.0.18 及更高版本)的 Teams 移动客户端版本。
猜你喜欢
  • 1970-01-01
  • 2022-06-24
  • 2021-01-02
  • 2021-06-08
  • 1970-01-01
  • 2021-12-28
  • 2021-10-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多