Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="player" class="player video pending">
- <div class="view-wrapper">
- <div class="view">
- <div id="video"></div>
- </div>
- </div>
- <div class="controls">
- <div class="item">
- <h1 class="title">Greetings and essentials</h1>
- <div class="time">-</div>
- </div>
- </div>
- <script>
- jQuery("#player").hide().fadeIn(500);
- var player;
- player = new YT.Player('video', {
- height: '360',
- width: '640',
- videoId: '',
- playerVars: {
- autoplay: 1,
- controls: 1,
- fs: 0,
- rel: 0,
- showinfo: 0,
- start: ,
- end: },
- events: {
- 'onReady': onPlayerReady,
- 'onStateChange': onPlayerStateChange,
- 'onError': onPlayerError
- }
- });
- function onPlayerReady(event) {
- event.target.playVideo();
- }
- function onPlayerStateChange(event) {
- if (event.data == YT.PlayerState.ENDED) {
- jQuery("#player").fadeOut(500, function () {
- lessonLearned();
- });
- }
- }
- function onPlayerError(event) {
- jQuery("#player").hide();
- jQuery.ajax({
- type: 'POST',
- url: '/lesson/error?id=18&videoCode=',
- data: {errorCode: event.data},
- cache: false,
- success: function (html) {
- jQuery("#player").replaceWith(html);
- }
- });
- }
- function lessonLearned() {
- jQuery.ajax({
- type: 'POST',
- dataType: 'json',
- url: '/lesson/stop?id=18',
- cache: false,
- success: function (data) {
- jQuery("#navbar").replaceWith(data.navbar);
- jQuery("#player").replaceWith(data.player);
- jQuery("#lessons").replaceWith(data.lessons);
- }
- });
- }
- </script>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment