Solution for Embedded YouTube Video Problems on Pure HMS Phones

Mustafa SARITEMUR
Huawei Developers
Published in
2 min readJun 30, 2021

As newer Huawei smart phones have HMS core only, they do not have support for Google related services directly. YouTube is also one of them and this will cause problem in some applications which uses embedded YouTube videos. Today I will mention about solution for this problem.

First of all let me explain the problem. New Huawei smart phones do not have GMS so google related services do not work with these phones. Official YouTube library (SDK) is also dependent for GMS. When an application have embedded YouTube videos, it mostly crashes when we try to run it on pure HMS phones. I was having same issue on an application which is planned to be released on Huawei AppGallery. So I tried to find a solution and found a third-party library.

This third-party library offers nearly every capability that official YouTube library have. It is easy to use. We can use this library as an alternative for pure HMS phones without having any problem. Also, we can use this library and official library together by checking GMS/HMS availability.

With these functions we can learn which service user has and decide which library (3rd party or Official) application should use. For the UI part when we decide the library we can use View visibility functions.

With this writing I tried to find a solution for YouTube video problem on Pure HMS phones. I hope this writing will help you.

Thank you.

--

--