PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.4k stars 756 forks source link

java.lang.IllegalArgumentException: connectHelper:924: Illegal argument to HAL module for camera "0" #1033

Open donny8chen opened 1 year ago

donny8chen commented 1 year ago
# Bug Report Tested devices: TV Box Android 7.0 Youtube Player Library Version: 11.1.0 Android compileSdkVersion: 33 Android targetSdkVersion: 22 Error logs: KTV com.smktvsystem D showYoutubePlayer onStateChange PLAYING KTV com.smktvsystem D showYoutubePlayer onVideoDuration KTV com.smktvsystem D showYoutubePlayer onCurrentSecond KTV com.smktvsystem D showYoutubePlayer onVideoLoadedFraction cr_media com.smktvsystem W Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording CameraManagerGlobal com.smktvsystem I Connecting to camera service chromium com.smktvsystem E [ERROR:web_contents_delegate.cc(197)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. System.err com.smktvsystem W java.lang.IllegalArgumentException: connectHelper:924: Illegal argument to HAL module for camera "0" System.err com.smktvsystem W at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:625) System.err com.smktvsystem W at android.hardware.camera2.CameraManager.getOrCreateDeviceIdListLocked(CameraManager.java:698) System.err com.smktvsystem W at android.hardware.camera2.CameraManager.getCameraIdList(CameraManager.java:98) System.err com.smktvsystem W at org.chromium.media.VideoCaptureCamera2.getNumberOfCameras(VideoCaptureCamera2.java:368) System.err com.smktvsystem W at org.chromium.media.VideoCaptureFactory$ChromiumCameraInfo.getNumberOfCameras(VideoCaptureFactory.java:76) System.err com.smktvsystem W at org.chromium.media.VideoCaptureFactory$ChromiumCameraInfo.access$300(VideoCaptureFactory.java:29) System.err com.smktvsystem W at org.chromium.media.VideoCaptureFactory.getNumberOfCameras(VideoCaptureFactory.java:110) System.err com.smktvsystem W Caused by: android.os.ServiceSpecificException: connectHelper:924: Illegal argument to HAL module for camera "0" System.err com.smktvsystem W at android.os.Parcel.readException(Parcel.java:1697) System.err com.smktvsystem W at android.os.Parcel.readException(Parcel.java:1636) System.err com.smktvsystem W at android.hardware.ICameraService$Stub$Proxy.getCameraCharacteristics(ICameraService.java:404) System.err com.smktvsystem W at android.hardware.camera2.CameraManager.getOrCreateDeviceIdListLocked(CameraManager.java:685) ### Additional information This is an Android TV development board, with audio and recording devices, but no camera device. When I call the loadVideo method, the screen displays the video picture, but after a short time, this error occurs, causing the APP to exit directly. I have no idea. Why does a video playback SDK need to record sound?
PierfrancescoSoffritti commented 1 year ago

The library doesn't record any sound. I think the error you're getting might not be related to this library.

donny8chen commented 1 year ago

There's run very well as code:

<html>
<body>
<iframe width="640" height="390" src="https://www.youtube.com/embed/47yJ2XCRLZs" 
frameborder="0" allowfullscreen></iframe>
</body>
</html>

When I use the code provided by the official, the above error will appear

<!DOCTYPE html>
<html>
<body>
<!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
<div id="player"></div>
<script>
      // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');

      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player)
      //    after the API code downloads.
      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'M7lc1UVf-VE',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }

      // 4. The API will call this function when the video player is ready.
      function onPlayerReady(event) {
        event.target.playVideo();
      }

      // 5. The API calls this function when the player's state changes.
      //    The function indicates that when playing a video (state=1),
      //    the player should play for six seconds and then stop.
      var done = false;
      function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.PLAYING && !done) {
          setTimeout(stopVideo, 6000);
          done = true;
        }
      }
      function stopVideo() {
        player.stopVideo();
      }
    </script>
</body>
</html>

So, I'm sure The IFrame player API uses the hardware dependent API