1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js "> </ script >
5
+
6
+ < script >
7
+ // 2. This code loads the IFrame Player API code asynchronously.
8
+ var tag = document . createElement ( 'script' ) ;
9
+ var first_launch = true ;
10
+ tag . src = "https://www.youtube.com/iframe_api" ;
11
+ var firstScriptTag = document . getElementsByTagName ( 'script' ) [ 0 ] ;
12
+ firstScriptTag . parentNode . insertBefore ( tag , firstScriptTag ) ;
13
+ var tm = '' ;
14
+
15
+
16
+
17
+
18
+
19
+ // 3. This function creates an <iframe> (and YouTube player)
20
+ // after the API code downloads.
21
+ var player ;
22
+ function onYouTubeIframeAPIReady ( ) {
23
+
24
+ player = new YT . Player ( 'player' , {
25
+ height : '390' ,
26
+ width : '640' ,
27
+ videoId : document . getElementById ( "v1" ) . value ,
28
+ events : {
29
+ 'onReady' : onPlayerReady ,
30
+ 'onStateChange' : onPlayerStateChange
31
+ }
32
+ } ) ;
33
+ }
34
+
35
+ // 4. The API will call this function when the video player is ready.
36
+ function onPlayerReady ( event ) {
37
+ event . target . playVideo ( ) ;
38
+ }
39
+
40
+ // 5. The API calls this function when the player's state changes.
41
+ // The function indicates that when playing a video (state=1),
42
+ // the player should play for six seconds and then stop.
43
+ var done = false ;
44
+ function onPlayerStateChange ( event ) {
45
+
46
+ if ( event . data == YT . PlayerState . PLAYING && ! done ) {
47
+ if ( first_launch ) {
48
+ document . getElementById ( "fm1" ) . submit ( )
49
+
50
+ first_launch = false
51
+ }
52
+ setTimeout ( stopVideo , 6000000 ) ;
53
+ done = true ;
54
+
55
+ }
56
+
57
+
58
+ }
59
+
60
+
61
+ function stopVideo ( ) {
62
+ player . stopVideo ( ) ;
63
+
64
+ }
65
+
66
+
67
+
68
+
69
+ function abc ( )
70
+ {
71
+ temp = player . getCurrentTime ( ) ;
72
+ //window.sessionStorage.setItem("iden",temp);
73
+ confrim ( "Do u want to?" ) ;
74
+
75
+ }
76
+
77
+ function loadingPage ( ) {
78
+
79
+ var st = document . getElementById ( "state_id" ) . value ;
80
+
81
+ if ( st == "confused" )
82
+ {
83
+
84
+ s = document . getElementById ( "s1" ) . value ;
85
+ v = document . getElementById ( "v1" ) . value ;
86
+ skt = document . getElementById ( "seek1" ) . value ;
87
+
88
+ document . getElementById ( "url_for_rec" ) . action = "{{ url_for('perform_rec') }}" + "?subject=" + s + "&video_id=" + v + "&seek_time=" + skt ;
89
+ console . log ( document . getElementById ( "url_for_rec" ) ) ;
90
+ document . getElementById ( "url_for_rec" ) . submit ( ) ;
91
+ }
92
+
93
+ }
94
+
95
+ </ script >
96
+
97
+
98
+
99
+ </ head >
100
+ < body onload ="loadingPage() " onbeforeunload ="abc() " background ="/static/bg1.jpg " style =""> < center >
101
+
102
+ <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
103
+ < div id ="player " style ="background-color: lightblue; " width =100% height =200% >
104
+ </ div >
105
+
106
+ < form action ="{{ url_for('launch') }} " id ="fm1 ">
107
+ < input type ='hidden ' id ="s2 " name ='subject ' value ='{{sub}} '/>
108
+ < input type ='hidden ' id ="v2 " name ='video_id ' value ='{{you_vid}} '/>
109
+ < input type ='hidden ' id ="seek2 " name ='seek_time ' value ={{ seek_time }} />
110
+
111
+
112
+ </ form >
113
+
114
+ < form method ="GET " action ="" id ="url_for_rec " enctype = "multipart/form-data ">
115
+ < input type ='hidden ' id ="s1 " name ='subject ' value ='{{sub}} '/>
116
+ < input type ='hidden ' id ="v1 " name ='video_id ' value ='{{you_vid}} '/>
117
+ < input type ='hidden ' id ="seek1 " name ='seek_time ' value ={{ seek_time }} />
118
+
119
+
120
+ < input id ="state_id " type ="hidden " value ="{{ state }} ">
121
+
122
+ < div id ="player " style ="background-color: lightblue " width =90% height =200% >
123
+ < br >
124
+ < h3 > < i > Additional Notes</ i > </ h3 >
125
+
126
+ {% if state!= 'NONE' %}
127
+
128
+ {% endif %}
129
+
130
+ < textarea rows ="25 " cols ="100 "> {{ wl }}</ textarea >
131
+
132
+ {% if seek_time!= "NONE" %}
133
+
134
+ {% endif %}
135
+ </ div >
136
+ </ center >
137
+ </ body >
138
+ </ html >
0 commit comments