{"id":3673,"url":"https://github.com/kevalpatel2106/UserAwareVideoView","last_synced_at":"2025-08-03T22:32:07.561Z","repository":{"id":140354659,"uuid":"72109644","full_name":"kevalpatel2106/UserAwareVideoView","owner":"kevalpatel2106","description":"A customized video view that will automatically pause video is user is not looking at device screen!!!!!","archived":false,"fork":false,"pushed_at":"2017-04-11T03:57:58.000Z","size":4037,"stargazers_count":51,"open_issues_count":1,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-16T15:39:39.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevalpatel2106.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-10-27T13:12:14.000Z","updated_at":"2021-06-27T08:00:59.000Z","dependencies_parsed_at":"2023-04-06T02:35:37.928Z","dependency_job_id":null,"html_url":"https://github.com/kevalpatel2106/UserAwareVideoView","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevalpatel2106%2FUserAwareVideoView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevalpatel2106%2FUserAwareVideoView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevalpatel2106%2FUserAwareVideoView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevalpatel2106%2FUserAwareVideoView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevalpatel2106","download_url":"https://codeload.github.com/kevalpatel2106/UserAwareVideoView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228571844,"owners_count":17938772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:48.186Z","updated_at":"2024-12-07T06:30:44.576Z","avatar_url":"https://github.com/kevalpatel2106.png","language":"Java","readme":"# UserAwareVideoView\n[![Build Status](https://travis-ci.org/kevalpatel2106/UserAwareVideoView.svg?branch=master)](https://travis-ci.org/kevalpatel2106/UserAwareVideoView) [ ![Download](https://api.bintray.com/packages/kevalpatel2106/maven/user-aware-videoview/images/download.svg) ](https://bintray.com/kevalpatel2106/maven/user-aware-videoview/_latestVersion) [![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/kevalpatel2106/UserAwareVideoView) [![API](https://img.shields.io/badge/API-15%2B-orange.svg?style=flat)](https://android-arsenal.com/api?level=15) \u003ca href=\"http://www.methodscount.com/?lib=com.kevalpatel2106%3Auserawarevideoview%3A1.0.2\"\u003e\u003cimg src=\"https://img.shields.io/badge/Methods count-core: 141 | deps: 23914-e91e63.svg\"/\u003e\u003c/a\u003e \u003ca href=\"http://www.methodscount.com/?lib=com.kevalpatel2106%3Auserawarevideoview%3A1.0.2\"\u003e\u003cimg src=\"https://img.shields.io/badge/Size-29 KB-e91e63.svg\"/\u003e\u003c/a\u003e\n\n\n\n## Featured in:\n- [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-UserAwareVideoView-green.svg?style=true)](https://android-arsenal.com/details/1/4569)\n- [Medium](https://medium.com/@kevalpatel2106/user-aware-video-view-4172c9f722e2#.i068pckyh)\n- [![awesome-android](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)]([![awesome-android](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://snowdream.github.io/awesome-android/Other.html#Utility))\n\n## What is this library for?\nUserAwareVideoView is a customizable VideoView that smartly play and pause the video based on your user is looking at the video or not. This uses Play Services Mobile Vision APIs to detect user's eyes. If the user is not looking at the screen than this will automatically pause the video, so your user does not miss any part of the video.\n\n## How to use this library???\n### Gradle dependency:\nAdd these lines to your `build.gradle` file to start integration. \n\n```\ndependency{\n    compile 'com.kevalpatel2106:userawarevideoview:1.0.2'\n}\n```\n\n- This library automatically adds `android.permission.CAMERA` permission in your applications `AndroidManifest.xml` file.\n\n### Add to XML layout:\nYou can use `UserAwareVideoView` just like you user the default VideoView in your layout. \n```\n \u003ccom.kevalpatel.userawarevieoview.UserAwareVideoView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:id=\"@+id/video_view\"/\u003e\n```\n\n### Initialize in your activity:\n- **Step-1:** Check for the Camera permission in runtime.\n- **Step-2:** Register `UserAwarenessListener` to get the callbacks from the `UserAwareVideoView` whenever error occurs in eyes detection or eye detection starts stops.\n- **Step-3:** Handle errors that may occur while eyes detection. \n```\nmVideoView = (UserAwareVideoView) findViewById(R.id.video_view);\nmVideoView.setUserAwarenessListener(new UserAwarenessListener() {\n            @Override\n            public void onErrorOccurred(int errorCode) {\n                //Handle errors.\n                 switch (errorCode) {\n                            case Errors.UNDEFINED:\n                                //Unknown error occured. \n                                //This will stop eye tracking, but video will keep playing.\n                                break;\n                            case Errors.FRONT_CAMERA_NOT_AVAILABLE:\n                                //This indicates that device doesnot have the front camera\n                                //This will stop eye tracking, but video will keep playing.\n                                break;\n                            case Errors.CAMERA_PERMISSION_NOT_AVAILABLE:\n                                //This indicates that camera permission is not available.\n                                //Ask for the runtime camera permission.\n                                break;\n                            case Errors.LOW_LIGHT:\n                                //This indicates that there is dark out side. We cannot detect user's face.\n                                //This will stop eye tracking, but video will keep playing.\n                                break;\n                        }\n            }\n\n            @Override\n            public void onEyeTrackingStarted() {\n                //Eye detection started\n            }\n\n            @Override\n            public void onEyeTrackingStop() {\n                //Eye detection is stopped.\n            }\n        });\n//Atatch your media controller, provide video to play and start the video\n//......\n//......\n```\n\nThat's it. UserAwareVideoView is ready to use.\n\n## Demo\n- You can download the sample apk from [here](/apk/sample.apk).\n- The video in sample apk is streamed online. So, make sure you have active internet connection.\n\n## Contribute:\n#### Simple 3 step to contribute into this repo:\n\n1. Fork the project. \n2. Make required changes and commit. \n3. Generate pull request. Mention all the required description regarding changes you made.\n\n## Questions\nHit me on twitter [![Twitter](https://img.shields.io/badge/Twitter-@kevalpatel2106-blue.svg?style=flat)](https://twitter.com/kevalpatel2106)\n\n## License\nCopyright 2017 Keval Patel\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n","funding_links":[],"categories":["Media","Libraries"],"sub_categories":["Other"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevalpatel2106%2FUserAwareVideoView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevalpatel2106%2FUserAwareVideoView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevalpatel2106%2FUserAwareVideoView/lists"}