# Problems embedding Youtube videos in Android

**URL:** <https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699>\
**Category:** ionic-v1\
**Created:** [January 30, 2015, 3:56pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699 "2015-01-30T15:56:53Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![pabloc](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/pabloc/32/76355_2.png) [@pabloc](https://forum.ionicframework.com/u/pabloc)\
**Post date:** [January 30, 2015, 3:56pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/1 "2015-01-30T15:56:54Z")

</div>

Hello,  
I have several problems to play youtube videos in an Android device. I know that there are a lot of post with comments about the same. But I’m not sure what i’m doing wrong.

My code is similar to this codepen: [http://codepen.io/akshaycs/pen/wBJozg/](http://codepen.io/akshaycs/pen/wBJozg/)

Also, I’m setting the youtube url directly in the template. It works better. It shows the youtube look&feel but when i want to play the video only sound works.

Here attached an image about how i’m seeing my phone screen:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/4/7/4775769ae401d0a461e07de50eb54e83c1981bc7.png)

Also, I don’t understand why message shows that I’m accessing a local file. The links are all externals.

Thanks!

---

<div class="post-metadata">

**Author:** ![Purusothaman](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@Purusothaman](https://forum.ionicframework.com/u/Purusothaman)\
**Post date:** [January 30, 2015, 4:07pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/2 "2015-01-30T16:07:48Z")

</div>

I don’t see any issue with your codepen. It works fine for me in my browser.

---

<div class="post-metadata">

**Author:** ![pabloc](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/pabloc/32/76355_2.png) [@pabloc](https://forum.ionicframework.com/u/pabloc)\
**Post date:** [January 30, 2015, 4:10pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/3 "2015-01-30T16:10:46Z")

</div>

Yes, the codepen works very well, but in browser. I couldn’t make it works in my Android device.

Thanks for your time

---

<div class="post-metadata">

**Author:** ![Purusothaman](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@Purusothaman](https://forum.ionicframework.com/u/Purusothaman)\
**Post date:** [January 30, 2015, 4:12pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/4 "2015-01-30T16:12:11Z")

</div>

Have you tried to white-list youtube domain in your config file? This might be the reason for android.

---

<div class="post-metadata">

**Author:** ![pabloc](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/pabloc/32/76355_2.png) [@pabloc](https://forum.ionicframework.com/u/pabloc)\
**Post date:** [January 30, 2015, 4:14pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/5 "2015-01-30T16:14:08Z")

</div>

Yes, I have this in my module config:

app.config(function($sceProvider, $stateProvider, $sceDelegateProvider) {  
$sceDelegateProvider.resourceUrlWhitelist([‘self’, new RegExp(’^(http[s]?)://(w{3}.)?[youtube.com/.+$](http://youtube.com/.+%24)’)]);  
});

---

<div class="post-metadata">

**Author:** ![Purusothaman](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@Purusothaman](https://forum.ionicframework.com/u/Purusothaman)\
**Post date:** [January 30, 2015, 4:17pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/6 "2015-01-30T16:17:50Z")

</div>

Sorry. I meant whitelisting domain in cordova/phonegap config.xml file.

Please refer to [http://cordova.apache.org/docs/en/4.0.0/guide\_appdev\_whitelist\_index.md.html](http://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html)

---

<div class="post-metadata">

**Author:** ![pabloc](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/pabloc/32/76355_2.png) [@pabloc](https://forum.ionicframework.com/u/pabloc)\
**Post date:** [January 30, 2015, 5:01pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/7 "2015-01-30T17:01:34Z")

</div>

I think that my configuration is fine.

```
<access origin="*"/>

```

I’ve made some progress using this directive:

> **[brandly/angular-youtube-embed](https://github.com/brandly/angular-youtube-embed)**
>
> angular-youtube-embed - :tv: Embed a YouTube player with a simple directive

Now, I can see the iframe with the initial frame. When I’m playing I only listen the audio and everything is black.

---

<div class="post-metadata">

**Author:** ![Purusothaman](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@Purusothaman](https://forum.ionicframework.com/u/Purusothaman)\
**Post date:** [January 30, 2015, 5:05pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/8 "2015-01-30T17:05:19Z")

</div>

Sorry. I am not able to help you in this if origin is not the problem for you.

Thanks for sharing the youtube directive.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [January 30, 2015, 7:20pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/9 "2015-01-30T19:20:20Z")

</div>

Hmm, I took a copy of the project but I didn’t have any issues with the video.  
The only thing I did though was change the format of the js.

> **[Youtube List](https://codepen.io/mhartington/pen/VYzNMp)**
>
> Forked from \[Akshay Chandrasekhar\](http://codepen.io/akshaycs/)'s Pen \[Youtube List\](http://codepen.io/akshaycs/pen/wBJozg/)....

---

<div class="post-metadata">

**Author:** ![pabloc](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/pabloc/32/76355_2.png) [@pabloc](https://forum.ionicframework.com/u/pabloc)\
**Post date:** [February 2, 2015, 10:00am UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/10 "2015-02-02T10:00:49Z")

</div>

Thank you so much for your response,

I’ve tested same code in other devices such as iPhone and other Android Tablet and it’s working.

But i’m still having the problem in Samsung Galaxy S2, Android 4.4.4, CyanongenMod last version. At the moment I don’t know how to solve it for this device.

Apart of that, I’m afraid how to assure the compatibility with all devices. I know that Crosswalk could solve this problem but I can’t publish an app with a size of more than 70mb.

Do you know how I can carry on this development and testing?

---

<div class="post-metadata">

**Author:** ![madgrizzle](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@madgrizzle](https://forum.ionicframework.com/u/madgrizzle)\
**Post date:** [February 16, 2015, 6:01pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/11 "2015-02-16T18:01:53Z")

</div>

I am having the exact same experience. I’ve tried using the nightly, turning off overflow-scroll, etc. but cannot get it to work on a 4.4.4 device. It works on 4.1.1 and 5.0 Genymotion emulators and a 4.4.1 device that I’ve tested. My 4.4.4 device is a Samsung Note 4. I was wondering if it’s something specific with Samsung’s software but you say you are running CyanogenMod…

Crosswalk does solve the problem for me… was contemplating going that way but now its a fait accompli. I suspect its an underlying bug in the version of Chromium used for 4.4.4.

---

<div class="post-metadata">

**Author:** ![luchus](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/luchus/32/95034_2.png) [@luchus](https://forum.ionicframework.com/u/luchus)\
**Post date:** [February 19, 2015, 1:24pm UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/12 "2015-02-19T13:24:54Z")

</div>

Same problem here. With Samsung S3 Cyanogenmod and Samsung S2 kitkat. Youtube embed videos play only with audio when put into iframe.

---

<div class="post-metadata">

**Author:** ![santosh](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@santosh](https://forum.ionicframework.com/u/santosh)\
**Post date:** [April 29, 2015, 10:30am UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/13 "2015-04-29T10:30:44Z")

</div>

I have tried this but run in browser not in device please help me what actually doing wrong ?

---

<div class="post-metadata">

**Author:** ![rajamohammed](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rajamohammed/32/93092_2.png) [@rajamohammed](https://forum.ionicframework.com/u/rajamohammed)\
**Post date:** [November 1, 2015, 11:02am UTC](https://forum.ionicframework.com/t/problems-embedding-youtube-videos-in-android/16699/14 "2015-11-01T11:02:52Z")

</div>

Without seeing the code no one can help , please share your code .
