Previously I'm able to embed youtube on Microsoft teams Adaptive Card, using a Task Module and an Iframe, I know Microsoft Stream doesn't have the functionality to share video to the public. So when the URL video is set to Microsoft Stream Video the Iframe is shown Sign and Sign in Page and when the sign is clicked it opens a new browser. I want to play video inside the Microsoft teams task module I thought it already using SSO and it doesn't need any Sign.
Here is the Screenshot of the task module
Here is my Iframe Page Source Code
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>
)
}
}
I don't know if it is possible to watch the Microsoft Stream inside the Task Module. Maybe I'm missing the sign-in method? I thought the Sign-in method is only for Axios call.