Comments (2)
The above script is not necessary, the component provides a way to do this out of the box. It receives a [protocol]
input that you can assign on the component:
<youtube-player protocol="http" ...>
Setting that will make it work anywhere. Obviously if you are running this from an actual website that is https you'd take care of that in that way. You can data bind it if you want too:
<youtube-player [protocol]="yourVarOrFuncThatDecidesProtocol" ...>
from ngx-youtube-player.
the issue fixed by adding this in index.html
<script> console.log("script loaded") if (!window['YT']) { var YT = { loading: 0, loaded: 0 }; } if (!window['YTConfig']) { var YTConfig = { 'host': 'http://www.youtube.com' }; } if (!YT.loading) { YT.loading = 1; (function () { var l = []; YT.ready = function (f) { if (YT.loaded) { f(); } else { l.push(f); } }; window.onYTReady = function () { YT.loaded = 1; for (var i = 0; i < l.length; i++) { try { l[i](); } catch (e) { } } }; YT.setConfig = function (c) { for (var k in c) { if (c.hasOwnProperty(k)) { YTConfig[k] = c[k]; } } }; var a = document.createElement('script'); a.type = 'text/javascript'; a.id = 'www-widgetapi-script'; a.src = 'https://s.ytimg.com/yts/jsbin/www-widgetapi-vfl-P7Nkv/www-widgetapi.js'; a.async = true; var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b); })(); } </script>
from ngx-youtube-player.
Related Issues (20)
- Unable to play video with playVideo()
- Unable to integrate this package in my Angular project
- Video frame doesn't show up on first load or hard reset HOT 2
- How to achieve parameters (related videos, controls) in player HOT 3
- Impossible to display settings (gear) icon HOT 1
- ready doesn't fire after first view load HOT 1
- can't hide "more videos element" HOT 4
- Angular Universal fail HOT 2
- The selector "#yt-player-ngx-component" did not match any elements HOT 2
- Clicking play on the StackBlitz demo doesn't seem to result in the video playing? HOT 1
- Electron build problems HOT 2
- Player fullscreen HOT 1
- getting "An error occurred. Please try again later. "
- ready function not working. HOT 2
- YoutubePlayerModule not exported HOT 1
- Dropping scarf dependency HOT 1
- Angular 8 & Cordova - ngx-youtube-player not working on Android HOT 1
- v12 release still requires angular v8 as a peer dependency HOT 2
- Angular 13 video not loading HOT 3
- The player doesn't show up! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-youtube-player.