dynamic data issue?
muneeb-arif opened this issue · comments
when by default there is no url set, browser console gives error "Please provide a valid youtube video URL or ID to render the iframe embed player. Read documentation here" whats the solution for that
also if is provide some default url so that it is rendered, when i click on other urls to change the iframe video url, why does it not auto play? its callback function for onready not working...
url: songstream.oso.nyc
much is put in console in all callbacks... i can share code if you like
here my video player
`
<ng-youtube-embed
video ="player.videoURL"
videoid="songstreamPlayer"
autoplay="player.autoplay"
controls="true"
color="white"
disablekb="false"
showinfo="false"
width="75%"
height="150px"
loop="player.loop"
enablejsapi="true"
onready="playerReady"
onstatechange="playerStateChanged"
onapichange="playerApiChange"
>
</ng-youtube-embed>
Hey @muneeb-arif,
Thanks a lot for reporting this issue, there was a problem with the scope variable watch mechanism for the video
parameter. The issue has been fixed, please update your library to the latest version i.e. 1.7.8
ok thanks.. quick question... how do i get player events? play / pause/ volume control etc..???
I've tried to perform event on player object but it gives undefiend error:
mPlayer = ngYoutubeEmbedService.getPlayerById('songstreamPlayer');
mPlayer.setVolume(50);
can you show some example .
Thanks
Can you please share your code here.
@ArunMichaelDsouza here is code . kindly have a look and guide what i'm missing here. Thanks
You have to make sure that the videoId
parameter set in the directive i.e. videoid="myPlayer"
is matching the id being requested by the ngYoutubeEmbedService
in this line - $scope.mPlayer = ngYoutubeEmbedService.getPlayerById('songstreamPlayer');
.
So it should be - $scope.mPlayer = ngYoutubeEmbedService.getPlayerById('myPlayer');
It does not work for the dynamic video
Here is my html
<ng-youtube-embed ivloadpolicy="false" videoid="myVideo" ccloadpolicy="false" video="Player.videoUrl" showinfo="false" autoplay="false" rel="false" enablejsapi="true" onready="playerReady" modestbranding="true" onstatechange="playerStateChanged" disablekb="true" width="100%" color="green" style="position: absolute;top:10px;width: 100%;"> </ng-youtube-embed>
javascript:
`$scope.playerStateChanged = function(event) {
console.log(event);
};
$scope.playerReady = function(event) {
event.target.playVideo() // this play also does not work all the time
};
$scope.playDynamicVideo = function(videoUrl) {
$scope.Player.videoUrl = videoUrl;
var player = ngYoutubeEmbedService.getPlayerById('myVideo');
player.playVideo();//does not work
player.loadVideoByUrl(videoUrl);
player.playVideo();//i tried this also but does not work
}`
I am using ng-youtube-embed v1.7.9
@ArunMichaelDsouza
Also the event does not work for dynamically added video.
@ArunMichaelDsouza: DO you have any update on this bug, player seems to be not working with dynamic scope value for videoId?
Thanks
@rui7999 can you please tell me what exact issue are you facing, please provide a code snippet if possible.
Closing due to inactivity.