Reputation: 3978
I have the following code to show youtube videos under ion-content tag
<div class="video-container">
<iframe src="{{videoUrl}}" frameborder="0" width="560" height="315"></iframe>
</div>
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}
.video-container iframe, .video-container object, .video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Its working fine in browser but when I run it on android device it simply says:
'restricted to play on certain websites watch it on youtube'
and its not allowing me to click on watch it on youtube link.
I am using trusted url using $sce.trustedResource .
I searched in google little bit and found that we need to add referrer but how to add referrer in ionic framework.
Upvotes: 3
Views: 547
Reputation: 2188
I have done a thorough research and I found out that there is no direct solution to this as the video is been protected by the owners against sites that doesn't provide their referral data by default, which the android doesn't have. But I created a page with the video embedded in it and uploaded it to my server and it played in android phone. So you can check it out here. So if you upload it to your server it will surely play on an android phone. But if you don't want to upload it to a server, then the only solution here is to download the video from this YouTube link and then upload it back to your YouTube channel where there is no more restiction then you embed the new uploaded video instead of the restricted one.
Upvotes: 4