Attempt to fix YouTube message error, added ads references, changes to bool
This commit is contained in:
		
							
								
								
									
										2
									
								
								demo/dist/demo.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								demo/dist/demo.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								demo/dist/demo.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								demo/dist/demo.js
									
									
									
									
										vendored
									
									
								
							| @ -1,3 +1,3 @@ | ||||
| !function(){"use strict";var e,t,o,i,a,r;document.addEventListener("DOMContentLoaded",function(){window.shr&&window.shr.setup({count:{classname:"button__count"}});document.addEventListener("focusout",function(e){e.target.classList.remove("tab-focus")}),document.addEventListener("keydown",function(e){9===e.keyCode&&window.setTimeout(function(){document.activeElement.classList.add("tab-focus")},0)});var e=new window.Plyr("#player",{debug:!0,title:"View From A Blue Moon",iconUrl:"../dist/plyr.svg",keyboard:{global:!0},tooltips:{controls:!0},captions:{active:!0},keys:{google:"AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c"},ads:{tag:"https://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480"}});window.player=e;var t=document.querySelectorAll("[data-source]"),o={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},i=window.location.hash.replace("#",""),a=window.history&&window.history.pushState;function r(e,t,o){e&&e.classList[o?"add":"remove"](t)}function n(a,n){if(a in o&&(n||a!==i)&&(i.length||a!==o.video)){switch(a){case o.video:e.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0},{kind:"captions",label:"French",srclang:"fr",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt"}]};break;case o.audio:e.source={type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]};break;case o.youtube:e.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://youtube.com/watch?v=bTqVqk7FSmY",provider:"youtube"}]};break;case o.vimeo:e.source={type:"video",sources:[{src:"https://vimeo.com/76979871",provider:"vimeo"}]}}i=a,Array.from(t).forEach(function(e){return r(e.parentElement,"active",!1)}),r(document.querySelector('[data-source="'+a+'"]'),"active",!0),Array.from(document.querySelectorAll(".plyr__cite")).forEach(function(e){e.setAttribute("hidden","")}),document.querySelector(".plyr__cite--"+a).removeAttribute("hidden")}}if(Array.from(t).forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-source");n(t),a&&window.history.pushState({type:t},"","#"+t)})}),window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&n(e.state.type)}),a){var s=!i.length;s&&(i=o.video),i in o&&window.history.replaceState({type:i},"",s?"":"#"+i),i!==o.video&&n(i,!0)}}),"plyr.io"===window.location.host&&(e=window,t=document,o="script",i="ga",e.GoogleAnalyticsObject=i,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,a=t.createElement(o),r=t.getElementsByTagName(o)[0],a.async=1,a.src="//www.google-analytics.com/analytics.js",r.parentNode.insertBefore(a,r),window.ga("create","UA-40881672-11","auto"),window.ga("send","pageview"))}(); | ||||
| !function(){"use strict";var e,t,o,i,r,n;document.addEventListener("DOMContentLoaded",function(){window.shr&&window.shr.setup({count:{classname:"button__count"}});document.addEventListener("focusout",function(e){e.target.classList.remove("tab-focus")}),document.addEventListener("keydown",function(e){9===e.keyCode&&window.setTimeout(function(){document.activeElement.classList.add("tab-focus")},0)});var e=new window.Plyr("#player",{debug:!0,title:"View From A Blue Moon",iconUrl:"../dist/plyr.svg",keyboard:{global:!0},tooltips:{controls:!0},captions:{active:!0},keys:{google:"AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c"},ads:{enabled:!0}});window.player=e;var t=document.querySelectorAll("[data-source]"),o={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},i=window.location.hash.replace("#",""),r=window.history&&window.history.pushState;function n(e,t,o){e&&e.classList[o?"add":"remove"](t)}function a(r,a){if(r in o&&(a||r!==i)&&(i.length||r!==o.video)){switch(r){case o.video:e.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0},{kind:"captions",label:"French",srclang:"fr",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt"}]};break;case o.audio:e.source={type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]};break;case o.youtube:e.source={type:"video",title:"View From A Blue Moon",sources:[{src:"https://youtube.com/watch?v=bTqVqk7FSmY",provider:"youtube"}]};break;case o.vimeo:e.source={type:"video",sources:[{src:"https://vimeo.com/76979871",provider:"vimeo"}]}}i=r,Array.from(t).forEach(function(e){return n(e.parentElement,"active",!1)}),n(document.querySelector('[data-source="'+r+'"]'),"active",!0),Array.from(document.querySelectorAll(".plyr__cite")).forEach(function(e){e.setAttribute("hidden","")}),document.querySelector(".plyr__cite--"+r).removeAttribute("hidden")}}if(Array.from(t).forEach(function(e){e.addEventListener("click",function(){var t=e.getAttribute("data-source");a(t),r&&window.history.pushState({type:t},"","#"+t)})}),window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&a(e.state.type)}),r){var s=!i.length;s&&(i=o.video),i in o&&window.history.replaceState({type:i},"",s?"":"#"+i),i!==o.video&&a(i,!0)}}),"plyr.io"===window.location.host&&(e=window,t=document,o="script",i="ga",e.GoogleAnalyticsObject=i,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,r=t.createElement(o),n=t.getElementsByTagName(o)[0],r.async=1,r.src="//www.google-analytics.com/analytics.js",n.parentNode.insertBefore(r,n),window.ga("create","UA-40881672-11","auto"),window.ga("send","pageview"))}(); | ||||
|  | ||||
| //# sourceMappingURL=demo.js.map | ||||
|  | ||||
							
								
								
									
										2
									
								
								demo/dist/demo.js.map
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								demo/dist/demo.js.map
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -65,8 +65,11 @@ | ||||
|                     </svg>Vimeo</button> | ||||
|             </p> | ||||
|  | ||||
|             <p>Advertisement service provided by | ||||
|                 <a href="https://vi.ai" target="_blank">vi.ai</a> | ||||
|             <p>Premium video monitization from | ||||
|                 <a href="https://vi.ai/publisher-video-monetization/" target="_blank" class="no-border"> | ||||
|                     <img src="https://cdn.plyr.io/static/vi-logo-24x24.svg" alt="ai.vi"> | ||||
|                     <span class="sr-only">ai.vi</span> | ||||
|                 </a> | ||||
|             </p> | ||||
|  | ||||
|             <div class="call-to-action"> | ||||
|  | ||||
| @ -52,11 +52,7 @@ document.addEventListener('DOMContentLoaded', () => { | ||||
|             google: 'AIzaSyDrNwtN3nLH_8rjCmu5Wq3ZCm4MNAVdc0c', | ||||
|         }, | ||||
|         ads: { | ||||
|             tag: | ||||
|                 'https://go.aniview.com/api/adserver6/vast/?AV_PUBLISHERID=58c25bb0073ef448b1087ad6&AV_CHANNELID=5a0458dc28a06145e4519d21&AV_URL=127.0.0.1:3000&cb=1&AV_WIDTH=640&AV_HEIGHT=480', | ||||
|             // Test tags | ||||
|             // tag: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=', | ||||
|             // tag: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpremidpost&cmsid=496&vid=short_onecue&correlator=', | ||||
|             enabled: true, | ||||
|         }, | ||||
|     }); | ||||
|  | ||||
|  | ||||
| @ -34,8 +34,13 @@ | ||||
| @import '../components/icons'; | ||||
| @import '../components/links'; | ||||
| @import '../components/lists'; | ||||
| @import '../components/media'; | ||||
| @import '../components/navigation'; | ||||
| @import '../components/players'; | ||||
|  | ||||
| // Plyr | ||||
| @import '../../../../src/sass/plyr'; | ||||
|  | ||||
| // Utils | ||||
| @import '../utilities/cosmetic'; | ||||
| @import '../utilities/hidden'; | ||||
|  | ||||
| @ -42,4 +42,8 @@ a { | ||||
|     &.tab-focus { | ||||
|         @include tab-focus(); | ||||
|     } | ||||
|  | ||||
|     &.no-border::after { | ||||
|         display: none; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,11 +1,10 @@ | ||||
| // ========================================================================== | ||||
| // Color | ||||
| // Basic media | ||||
| // ========================================================================== | ||||
| 
 | ||||
| .color--vimeo { | ||||
|     color: $color-vimeo; | ||||
| } | ||||
| 
 | ||||
| .color--youtube { | ||||
|     color: $color-youtube; | ||||
| img, | ||||
| video, | ||||
| audio { | ||||
|     max-width: 100%; | ||||
|     vertical-align: middle; | ||||
| } | ||||
							
								
								
									
										7
									
								
								demo/src/sass/utilities/cosmetic.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								demo/src/sass/utilities/cosmetic.scss
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| // ========================================================================== | ||||
| // Misc cosmetic | ||||
| // ========================================================================== | ||||
|  | ||||
| .no-border { | ||||
|     border: 0; | ||||
| } | ||||
| @ -5,3 +5,16 @@ | ||||
| [hidden] { | ||||
|     display: none; | ||||
| } | ||||
|  | ||||
| // Hide only visually, but have it available for screen readers: h5bp.com/v | ||||
| .sr-only { | ||||
|     border: 0; | ||||
|     clip: rect(0 0 0 0); | ||||
|     height: 1px; | ||||
|     margin: -1px; | ||||
|     opacity: 0.001; | ||||
|     overflow: hidden; | ||||
|     padding: 0; | ||||
|     position: absolute; | ||||
|     width: 1px; | ||||
| } | ||||
|  | ||||
							
								
								
									
										2
									
								
								dist/plyr.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/plyr.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/plyr.js.map
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/plyr.js.map
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -363,9 +363,10 @@ const defaults = { | ||||
|         google: null, | ||||
|     }, | ||||
|  | ||||
|     // Ads | ||||
|     // Advertisements plugin | ||||
|     // Tag is not required as publisher is determined by vi.ai using the domain | ||||
|     ads: { | ||||
|         tag: null, | ||||
|         enabled: false, | ||||
|     }, | ||||
| }; | ||||
|  | ||||
|  | ||||
| @ -8,6 +8,22 @@ | ||||
|  | ||||
| import utils from '../utils'; | ||||
|  | ||||
| // Build the default tag URL | ||||
| const getTagUrl = () => { | ||||
|     const params = { | ||||
|         AV_PUBLISHERID: '58c25bb0073ef448b1087ad6', | ||||
|         AV_CHANNELID: '5a0458dc28a06145e4519d21', | ||||
|         AV_URL: '127.0.0.1:3000', | ||||
|         cb: 1, | ||||
|         AV_WIDTH: 640, | ||||
|         AV_HEIGHT: 480, | ||||
|     }; | ||||
|  | ||||
|     const base = 'https://go.aniview.com/api/adserver6/vast/'; | ||||
|  | ||||
|     return `${base}?${utils.buildUrlParams(params)}`; | ||||
| }; | ||||
|  | ||||
| class Ads { | ||||
|     /** | ||||
|      * Ads constructor. | ||||
| @ -16,9 +32,9 @@ class Ads { | ||||
|      */ | ||||
|     constructor(player) { | ||||
|         this.player = player; | ||||
|         this.enabled = player.config.ads.enabled; | ||||
|         this.playing = false; | ||||
|         this.initialized = false; | ||||
|         this.enabled = utils.is.url(player.config.ads.tag); | ||||
|  | ||||
|         // Check if a tag URL is provided. | ||||
|         if (!this.enabled) { | ||||
| @ -122,7 +138,7 @@ class Ads { | ||||
|  | ||||
|             // Request video ads | ||||
|             const request = new google.ima.AdsRequest(); | ||||
|             request.adTagUrl = this.player.config.ads.tag; | ||||
|             request.adTagUrl = getTagUrl(); | ||||
|  | ||||
|             // Specify the linear and nonlinear slot sizes. This helps the SDK | ||||
|             // to select the correct creative if multiple are returned | ||||
|  | ||||
| @ -108,8 +108,8 @@ const youtube = { | ||||
|                 playsinline: 1, // Allow iOS inline playback | ||||
|  | ||||
|                 // Tracking for stats | ||||
|                 origin: window && window.location.hostname, | ||||
|                 widget_referrer: window && window.location.href, | ||||
|                 // origin: window ? `${window.location.protocol}//${window.location.host}` : null, | ||||
|                 widget_referrer: window ? window.location.href : null, | ||||
|  | ||||
|                 // Captions are flaky on YouTube | ||||
|                 cc_load_policy: player.captions.active ? 1 : 0, | ||||
|  | ||||
| @ -309,11 +309,14 @@ class Plyr { | ||||
|      * Play the media, or play the advertisement | ||||
|      */ | ||||
|     play() { | ||||
|         // Play the ad if setup | ||||
|         // TODO: Fix the occasional play of the video before the Ad fires? | ||||
|         if (this.ads.enabled && !this.ads.initialized) { | ||||
|             this.ads.play(); | ||||
|         } | ||||
|  | ||||
|         this.media.play(); | ||||
|         // Return the promise (for HTML5) | ||||
|         return this.media.play(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|  | ||||
		Reference in New Issue
	
	Block a user