Nativescript: Android issue with videos embedded on WebView playing only audio no video.

Created on 21 Nov 2017  路  9Comments  路  Source: NativeScript/NativeScript

Please, provide the details below:

Main problem is with Android (both emulator and device). Using WebView to show and play a video (YouTube/Vimeo) audio works fine but with video got blank or black screen.

image

Did you verify this is a real problem by searching [Stack Overflow]

Yes, I found a few links that may help with this:

Tell us about the problem

Android issue with videos embedded on WebView playing only audio no video

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

Please tell us how to recreate the issue in as much detail as possible.

1) Clone the repo
git clone https://github.com/iecoding/NativeScript-Android-Issue-with-Videos.git

2) Change directory and run Install npm packages
cd NativeScript-Android-Issue-with-Videos
install npm

3) Run the app on android
tns run android

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

No additional code (i think)

This issue is also on {N} Discourse Community https://discourse.nativescript.org/t/android-issue-with-videos-playing-only-audio-no-video-using-webview/3153

Any help will make me alive. Thanks

_ _
Israel Estrada

android

Most helpful comment

@iecoding How did you fix this? I am facing the same issue on android emulators, only audio plays and no video.

All 9 comments

@iecoding this is a limitation for native Android developers as well and the reason is the way YouTube API is working. In fact, your snippet runs the YouTube video perfectly on my Nexus 5x (with Android Oreo) however this is not a valid case for the emulator and a number of other devices.

AS recommended by YouTube and Google the best approach would be to use the YouTube APi (create a NativeScript plugin). Another approach would be to use nativescript-videoplayer along with nativescript-youtube-parser plugin.

@NickIliev thank you so much!

I was trying with my old huawei phone that runs android 4.3 and of course did not work.

I borrowed a coworker phone that have Android 6.0 and works like a charm!

Beginner mistake.

@NickIliev i did a nativescript-youtubeplayer a couple months ago

@iecoding How did you fix this? I am facing the same issue on android emulators, only audio plays and no video.

I have a TV that is android 4.3 . There is no upgrade. So one have to fix issues like this.

Btw, I have downloaded the youtube api player demo but it cannot run yet.
Immediately I have to change the target version. Have to take more time to try it.

@NickIliev but nativescript-videoplayer does not support adaptive streaming does it?

We have a different issue. Video from Vimeo playing normally, but no sound :D Any ideas?

How to make video full screen in webview?

Was this page helpful?
0 / 5 - 0 ratings