forked from HarishGangula/quizServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.html
114 lines (108 loc) · 3.86 KB
/
player.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<html lang="en" ng-app="playerApp">
<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>Quiz</title>
<link rel="stylesheet" href="./semantic/semantic.min.css" />
<style type="text/css">
iframe {
border: 1px solid #ddd;
}
</style>
</head>
<body ng-controller="playerAppController as player">
<div>
<div ng-hide="quizStarted" style="height: 100vh;">
<img src="please_wait.jpg" alt="" style="display: block;width: 50%;margin: auto;" />
</div>
<div class="ifrmae-container" ng-show="quizStarted">
<iframe id="previewContentIframe"></iframe>
</div>
</div>
</body>
<script src="angular.js"></script>
<script src="angular-sanitize.min.js"></script>
<script src="./node_modules/timer.js/dist/timer.min.js"></script>
<script src="./node_modules/jquery/dist/jquery.min.js"></script>
<script src="./semantic/semantic.min.js"></script>
<script src="socket.io.js"></script>
<script src="lodash.min.js"></script>
<script src="socket.js"></script>
<script src="uuid.min.js"></script>
<script src="faker.js"></script>
<script>
$(document).ready(function() {
var wv = $(window).width();
var h = $(window).height();
var w = (h*16)/9;
var previewContentIframe = $('#previewContentIframe')[0];
$("iframe").width(w);
$("iframe").height(h);
$("iframe").css({"margin-left": (((wv-w)/2) - 1)});
});
angular.module("playerApp", ["ngSanitize"])
.controller("playerAppController", function(
$interval,
$timeout,
$scope
) {
var socket = io();
faker.locale = "en_IND";
var user = {
code: faker.random.uuid(),
name: faker.name.findName()
}
var cdata = [{ "id": user.name, "type": "userName" }, { "id": user.code, "type": "userId" }]
socket.on("startQuiz", function(data) {
$scope.quizStarted = true;
var previewContentIframe = $('#previewContentIframe')[0];
previewContentIframe.src = '/content/preview/preview.html?webview=true';
var configuration = {
context: {
mode: "play",
contentId: data.metadata.identifier,
sid: "7W23qQKd_n4wT17sxVeLsG55t2FOZ6Bi",
uid: "874ed8a5-782e-4f6c-8f36-e0288455901e",
channel: "b00bc992ef25f1a9a8d63291e20efc8d",
pdata: {
"id": "dev.sunbird.portal",
"ver": "1.14.0",
"pid": "sunbird-portal.contenteditor"
},
cdata: cdata,
app: [],
dims: [],
partner: []
},
config: {
repos: ["/sunbird-plugins/renderer"],
plugins: [{
"id": "org.sunbird.player.endpage",
"ver": 1.1,
"type": "plugin"
}],
splash: {
"text": "",
"icon": "",
"bgImage": "assets/icons/splacebackground_1.png",
"webLink": ""
},
overlay: { "showUser": false },
showEndPage: false
},
metadata: data.metadata,
data: data.body
}
previewContentIframe.onload = function() {
previewContentIframe.contentWindow.initializePreview(configuration);
}
$scope.$apply();
});
$scope.restartQuiz = function() {
window.location.replace("/player2.html");
};
});
</script>
</html>