
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
video.api:android-player
Advanced tools
api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
Easily integrate a video player for videos from api.video in your Android application. The api.video Android player will help you to play the HLS video from api.video. It also generates analytics of your viewers usage.
In your module build.gradle
, add the following code in dependencies
:
dependencies {
implementation 'video.api:android-player:1.6.0'
}
For Jetpack Compose, also add the following code in dependencies
:
dependencies {
implementation 'video.api:android-compose-player:1.6.0'
}
At this point, you must have uploaded a least one video to your account. If you haven't see how to upload a video. You'll need a video Id to use this component and play a video from api.video. To get yours, follow these steps:
get
request to the /videos
endpoint based on the reference, using a tool like Postman.Alternatively, you can find your video Id in the video details of your dashboard.
The api.video Android player comes with a view ApiVideoExoPlayerView
to display the video and its
controller ApiVideoPlayerController
.
ApiVideoExoPlayerView
to your Activity/Fragment layout:
<video.api.player.ApiVideoExoPlayerView
android:id="@+id/playerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:show_controls="true"
app:show_subtitles="true" />
You can also use an ExoPlayer PlayerView
or a SurfaceView
according to your requirements.
See Supported player views for more details.
ApiVideoPlayerController.Listener
interface:val playerControllerListener = object : ApiVideoPlayerController.Listener {
override fun onError(error: Exception) {
Log.e(TAG, "An error happened", error)
}
override fun onReady() {
Log.I(TAG, "Player is ready")
}
}
ApiVideoPlayerController
in an your Activity/Fragment:val playerView = findViewById<ApiVideoExoPlayerView>(R.id.playerView)
val playerController = ApiVideoPlayerController(
applicationContext,
VideoOptions(
"YOUR_VIDEO_ID",
VideoType.VOD
), // For private video: VideoOptions("YOUR_VIDEO_ID", VideoType.VOD, "YOUR_PRIVATE_VIDEO_TOKEN")
playerListener,
playerView
)
If you require a fullscreen video. You will have to implement
the ApiVideoExoPlayerView.FullScreenListener
interface.
To help you, you can use the ApiVideoPlayerFullScreenController
that will handle the fullscreen.
As it implements the ApiVideoExoPlayerView.FullScreenListener
interface, you can pass it to
your ApiVideoExoPlayerView
instance.
playerView.fullScreenListener = ApiVideoExoPlayerView(
supportFragmentManager,
playerView,
playerController
)
Check out for the implementation in the Sample application.
The api.video Android player comes with a specific view ApiVideoExoPlayerView
to display the video
and its controller. If you require a customization of this view such as changing a button color,...,
you can contact us.
Otherwise, in the ApiVideoPlayerController
, you can also use the following views:
PlayerView
: ExoPlayer
views from media3
SurfaceView
Surface
The SurfaceView
and the Surface
require more work to be used.
The api.video Android player comes with a composable ApiVideoPlayer
to display the video from a
compose application. In your application, you can add:
ApiVideoPlayer(
videoOptions = VideoOptions("YOUR_VIDEO_ID", VideoType.VOD),
)
If you want to use the ExoPlayer directly, you can use the api.video Android extensions:
val videoOptions = VideoOptions("YOUR_VIDEO_ID", VideoType.VOD)
// For private video: VideoOptions("YOUR_VIDEO_ID", VideoType.VOD, "YOUR_PRIVATE_VIDEO_TOKEN")
For ExoPlayer:
val exoplayer = ExoPlayer.Builder(context).build() // You already have that in your code
exoplayer.addMediaSource(videoOptions)
// Or
exoplayer.setMediaSource(videoOptions)
For MediaPlayer:
val mediaPlayer = MediaPlayer() // You already have that in your code
mediaPlayer.setDataSource(context, videoOptions)
For VideoView:
val videoView = binding.videoView // You already have that in your code
videoView.setVideo(videoOptions)
A demo application demonstrates how to use player.
See /examples
folder.
On the first run, you will have to set your video Id:
We are using external library
Plugin | README |
---|---|
Exoplayer | README.md |
If you have any questions, ask us in the community or use issues.
FAQs
Android player for api.video delivery.
We found that video.api:android-player demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.