Agora smart classroom launch issue - webrtc

Hi I have integrated Agora flexible classroom for e-learning platform however when I try to initiate classroom I am getting error in pop-up I don't have any idea about this.
please help to rectify this issue.
Code`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://download.agora.io/edu-apaas/release/edu_sdk#2.6.1.bundle.js"></script>
</head>
<body>
<style>
#root {
width: 100%;
height: 100%;
}
</style>
<div id="root"></div>
<script type="text/javascript">
fetch('generateToken.php',
{ method: "GET"
})
.then((response) => {
return response.json();
})
.then((data) => {
let rtm_token = data;
AgoraEduSDK.config({
appId: 'd0ba6d731d14446784acc2b68432a764',
region: 'AP'
});
AgoraEduSDK.launch(document.querySelector('#root'), {
userUuid: '1',
userName: 'Abdul Ghani',
roomUuid: '1',
roleType: 1,
roomType: 4,
roomName: 'My Class Room',
pretest: true,
rtmToken: rtm_token,
language: 'en',
duration: 60 * 30,
// recordUrl: 'https://solutions-apaas.agora.io/apaas/record/dev/2.3.3/record_page.html',
courseWareList: [],
listener: (evt, args) => {
},
}).then(() => {
console.log('start launch');
}).catch((e) => {
console.error('fail to launch', e);
});
})
</script>
</body>
</html>
`:
Agora Classroom:
error screenshot

Related

Using Vue Formulate with a schema

I try to get Vue Formulate running, but it just does not work. Here is my code:
this version includes the import statements:
https://vueformulate.com/guide/installation/#direct-download
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/#braid/vue-formulate#2.4.1/dist/formulate.umd.min.js"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es2015"></script>
<template>
<FormulateForm
v-model="values"
:schema="schema"
/>
</template>
<script>
import Vue from 'vue'
import VueFormulate from '#braid/vue-formulate'
Vue.use(VueFormulate)
export default {
data () {
return {
values: {},
schema: [
{
type: 'password',
name: 'password',
label: 'Enter a new password',
validation: 'required'
},
{
type: 'password',
name: 'password_confirm',
label: 'Confirm your password',
validation: '^required|confirm:password',
validationName: 'Password confirmation'
},
{
type: 'submit',
label: 'Change password'
}
]
}
}
}
</script>
Opening the site results in the following error appearing in the console:
formulate.umd.min.js:5 Uncaught TypeError: Cannot read property 'en' of undefined
at new Jt (formulate.umd.min.js:5)
at formulate.umd.min.js:5
at formulate.umd.min.js:5
at formulate.umd.min.js:5
Jt # formulate.umd.min.js:5
(anonymous) # formulate.umd.min.js:5
(anonymous) # formulate.umd.min.js:5
(anonymous) # formulate.umd.min.js:5
test.html:15 Uncaught SyntaxError: Unexpected token 'export'
Thanks!
The issue is due partially to DOM limitations, as explained in the small note in Vue Formulate's documentation on direct downloads. To be more specific, since we are not using a builder but downloading the libraries from a CDN and inserting them with script tags, all components names must be kebab-case. We also need to create a Vue instance.
Vue.use(VueFormulate)
new Vue({
el: '#app',
data: function () {
return {
values: {}
}
}
})
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Vue-Formulate example">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Vue Formulate</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/#braid/vue-formulate#2.3.8/dist/formulate.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/#braid/vue-formulate#2.3.8/dist/snow.css">
</head>
<body>
<div id="app">
<formulate-form v-model="values">
<formulate-input
type="password"
name="password"
label="Enter a new password">
</formulate-input>
<formulate-input
type="password"
name="password_confirm"
label="Confirm your password"
validation="required|confirm:password"
validation_name="Password confirmation">
<formulate-input
type="submit"
label="Change password">
</formulate-form>
</formulate-form>
<p><strong>This is your password: {{ values }}</strong></p>
</div>
</body>
</html>
The same but with Schemas (please note that Vue-Formulate needs to be version 2.4 or above):
Vue.use(VueFormulate)
var app = new Vue({
el: '#app',
data: function () {
return {
values: {},
schema: [
{
type: 'password',
name: 'password',
label: 'Enter a new password',
validation: 'required'
},
{
type: 'password',
name: 'password_confirm',
label: 'Confirm your password',
validation: '^required|confirm:password',
validationName: 'Password confirmation'
},
{
type: 'submit',
label: 'Change password'
}
]
}
}
})
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Vue-Formulate example">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Vue Formulate with Schema</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/#braid/vue-formulate#2.4.1/dist/formulate.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/#braid/vue-formulate#2.3.8/dist/snow.css">
</head>
<body>
<div id="app">
<formulate-form v-model="values" :schema="schema"/>
<p><strong>This is your password: {{ values }}</strong></p>
</div>
</body>
</html>

Fetch data from database, store it in array, to plot charts in vuejs

I'm trying to plot a graph in vue-chartjs.
I want to get the required values from my MySQL database and store them into an array. And then use them to plot the charts. But I can't quite figure out the logic on how to get those records from the DB.
This is the code I tried
<?php
$servername = "172.18.2.2";
$username = "cs161050";
$password = "aman";
$dbname = "0187cs161050";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT progress FROM wf_progress";
$result = $conn->query($sql);
if ($result->num_rows) {
// output data of each row
while($row = $result->fetch_assoc()) {
return $row;
}
}
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Circle Gauge Chart - Multiple</title>
<style>
#chart {
max-width: 650px;
margin: 35px auto;
}
</style>
</head>
<body>
<div id="chart">
</div>
<script src="https://cdn.jsdelivr.net/npm/apexcharts#latest"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
var options = {
chart: {
height: 250,
type: 'radialBar',
},
plotOptions: {
radialBar: {
dataLabels: {
name: {
fontSize: '22px',
},
value: {
fontSize: '16px',
},
total: {
show: true,
label: 'Total',
formatter: function (w) {
return 249
}
}
}
}
},
series: []
},
methods: {
concatArray: function() {
axios.get('script.php')
.then(function (response) {
this.series = this.series.concat(response.data);
})
.catch(function(error) {
console.log(error);
})
}
}
var chart = new ApexCharts(
document.querySelector("#chart"),
options
);
chart.render();
</script>
</body>
</html>
Can anyone tell what am I doing wrong here?

How to include promises in vuejs methods

The code below has vuejs methods. One is calling another through the promise function. How can I make handleStart be invoked first, then once done is true, foo will be resolve, and handleStart will finish. The start button must be clicked first
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<button
#click="handleStart"
>
START
</button>
<button
#click="done = true"
>DONE</button>
<h1>Start the app: {{start}}</h1>
<h1>Is it done? {{done}}</h1>
</div>
<script>
var app = new Vue({
el: '#app',
data () {
return {
start: false,
done:false
}
},
methods: {
foo() {
return new Promise( (resolve) => {
if (this.done) {
console.log("done is recorded")
resolve("Yaa")
}
})
},
handleStart () {
this.start = true
// how to make this an obsersable
this.foo()
.then( (data ) => console.log("I must be printed with:", data))
}
}
})
</script>
</body>
</html>
you need to use watchers to watch this.done change
watch: {
done(newVal, oldVal) {
if (newVal) {
// do something
}
}
},
methods: {
async handleStart () {
// how to make this async
this.start = true
const data = await this.foo()
console.log("I must be printed with:", data))
}
}
The problem is with the if (this.done) check.
When done is false, the promise is never resolved, and the handleStart never receives data.
If you need to react when a data has changed, take a look Vue's watchers

jQuery EasyUI -ComboGrid Function

I wnat to show to display grid in combo box using jquery easy ui plugin with asp.net mvc. But I took that error "Uncaught TypeError: $(...).combogrid is not a function". Where is the error?
My View Code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ComboGrid - jQuery EasyUI Demo</title>
<link href="#Url.Content("~/Content/themes/easyui.css")" rel="stylesheet" />
<link href="#Url.Content("~/Content/themes/icon.css")" rel="stylesheet" />
<link href="#Url.Content("~/Content/themes/demo.css")" rel="stylesheet" />
<script type="text/javascript" src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.easyui.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery.combogrid.js"></script>
<script type="text/javascript">
$(function () {
$('#cc').combogrid({
panelWidth: 450,
value: '006',
idField: 'code',
textField: 'name',
url: 'datagrid_data.json',
columns: [[
{ field: 'code', title: 'Code', width: 60 },
{ field: 'name', title: 'Name', width: 100 },
{ field: 'addr', title: 'Address', width: 120 },
{ field: 'col4', title: 'Col41', width: 100 }
]]
});
});
function reload() {
$('#cc').combogrid('grid').datagrid('reload');
}
function setValue() {
$('#cc').combogrid('setValue', '002');
}
function getValue() {
var val = $('#cc').combogrid('getValue');
alert(val);
}
function disable() {
$('#cc').combogrid('disable');
}
function enable() {
$('#cc').combogrid('enable');
}
</script>
</head>
<body>
<h2>ComboGrid</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>Click the right arrow button to show the datagrid.</div>
</div>
<div style="margin:10px 0;">
Reload
SetValue
GetValue
Disable
Enable
</div>
<select id="cc" name="dept" style="width:250px;"></select>
</body>
</html>
You can remove
<script type="text/javascript" src="~/Scripts/jquery.combogrid.js"></script>
because jquery.easyui.min.js includes combogrid function.

How to create a dojo 1.9 slideshow

This is (part of) a web page. For some reason, I fail to get the slide-show operational. Can you help me fix it?
<!DOCTYPE html>
<html>
<head lang='fr'>
<meta http-equiv='content-type' content='text/html;charset=ISO-8859-1' />
<link href='../dojo-release-1.9.1/dijit/themes/claro/claro.css' rel='stylesheet' type='text/css' media='all' />
</head>
<body class='claro'>
<script>
dojoConfig = {async: true, parseOnLoad: true}
</script>
<script type='text/javascript' src='../dojo-release-1.9.1/dojo/dojo.js'>
</script>
<script type='text/javascript'>
require(["dojo", "dojo/parser", "dojo/store/Memory", "dojox/image/SlideShow"]);
var imageData= {
identifier: "imageUrl",
items: [
{ imageUrl: "http://mysyte.net/photos/f1.jpg"},
{ imageUrl: "http://mysyte.net/photos/f2.jpg"},
{ imageUrl: "http://mysyte.net/photos/f3.jpg"},
{ imageUrl: "http://mysyte.net/photos/f4.jpg"}
]
};
</script>
<div data-dojo-type='dojo/store/Memory' data-dojo-props='data:imageData' data-dojo-id='imageStore'></div>
<div data-dojo-type='dojox/image/SlideShow' id='slideshow1' data-dojo-id='imageShow'
data-dojo-props='store: imageStore, noLink: true, autoStart:true, imageWidth:770, imageHeight:345, slideshowInterval: 5'>
</div>
</body>
</html>
What am I missing?? Can you help me fixing it? Thanks!
Problem solved.
<!DOCTYPE html>
<html>
<head lang='fr'>
<meta http-equiv='content-type' content='text/html;charset=ISO-8859-1' />
<link href='../dojo-release-1.9.1/dijit/themes/claro/claro.css' rel='stylesheet' type='text/css' media='all' />
</head>
<body class='claro'>
<script>
dojoConfig = {async: true, parseOnLoad: true}
</script>
<script type='text/javascript' src='../dojo-release-1.9.1/dojo/dojo.js'></script>
<script type='text/javascript'>
var imageData= {
identifier: "imageUrl",
items: [
{ imageUrl: "http://mysyte.net/photos/f1.jpg"},
{ imageUrl: "http://mysyte.net/photos/f2.jpg"},
{ imageUrl: "http://mysyte.net/photos/f3.jpg"},
{ imageUrl: "http://mysyte.net/photos/f4.jpg"}
]
};
require(["dojo", "dojo/data/ItemFileReadStore", "dojox/image/SlideShow", "dijit/registry"], function(dojo, ItemFileReadStore, SlideShow, registry) {
dojo.ready(function() {
registry.byId('slideshow1').setDataStore(imageStore, {})
})
});
</script>
<div data-dojo-type='dojo/data/ItemFileReadStore' data-dojo-props='data:imageData' data-dojo-id='imageStore'></div>
<div data-dojo-type='dojox/image/SlideShow' id='slideshow1' data-dojo-id='imageShow'
data-dojo-props='autoStart:true, showTitle: false, noLink: true, hasNav: false, imageWidth:770, imageHeight:345, fixedHeight: true, slideshowInterval: 5'>
</div>
</body>
</html>
Apparently, the SlideShow object in dojo has some bugs/inconsistencies. I even had to modify the dojox/image/SlideShow.js file. The clues I found here: http://petergragert.info/dojo/demo/PKHG_won_22feb.html and in http://dojo-toolkit.33424.n3.nabble.com/Dojo-1-8-SlideShow-Problem-tp3991064.html