Skip to content

Commit a742f58

Browse files
authored
Update README.md in favor of new Android SDK
1 parent 8b30966 commit a742f58

File tree

1 file changed

+3
-155
lines changed

1 file changed

+3
-155
lines changed

README.md

+3-155
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,3 @@
1-
Dailymotion Player SDK Android
2-
===========================
3-
[ ![Download](https://api.bintray.com/packages/dailymotion/com.dailymotion.dailymotion-sdk-android/sdk/images/download.svg) ](https://bintray.com/dailymotion/com.dailymotion.dailymotion-sdk-android/sdk/_latestVersion)
4-
[![Build Status](https://travis-ci.org/dailymotion/dailymotion-player-sdk-android.svg?branch=master)](https://travis-ci.org/dailymotion/dailymotion-player-sdk-android)
5-
6-
Our Android SDK allows for effortless embedding of the Dailymotion video player in your Android application using a WebView. It supports api level 21+.
7-
This SDK that we provide to our publishers is the same tool we use to create our flagship Dailymotion applications. It provides access to the Player API and gives you full control of the player. To learn more please check out official Dailymotion Android developer doc [here](https://developer.dailymotion.com/player/#embed-mobile-android).
8-
9-
Features
10-
--------
11-
12-
- Simple SDK to integrate, provides access to the Player API, no need to specify a layout container for the VideoView
13-
- The SDK is bundled with a sample application
14-
- Supports Android 5.0.x (API level 21) and superior
15-
- Fully in kotlin. If your project is still in JAVA, you will need to add the kotlin dependencies: https://developer.android.com/kotlin/add-kotlin
16-
17-
How to use
18-
----------
19-
20-
### Add the SDK to your project
21-
You can either import the SDK using your IDE or integrate PlayerWebView.kt in your project.
22-
23-
Our artefacts are hosted on `mavenCentral` <br/>
24-
Using gradle, you can import the sdk with :
25-
```
26-
implementation 'com.dailymotion.dailymotion-sdk-android:sdk:0.2.12'
27-
```
28-
29-
The sdk will need the following permission and attributes inside your `AndroidManifest.xml`:
30-
```
31-
<uses-permission android:name="android.permission.INTERNET" />
32-
```
33-
34-
```
35-
android:hardwareAccelerated="true"
36-
```
37-
38-
### Use in your Activity or Fragment
39-
First, add the PlayerWebView in your layout in place of the regular WebView.
40-
41-
```xml
42-
<com.dailymotion.android.player.sdk.PlayerWebView
43-
android:id="@+id/dm_player_web_view"
44-
android:layout_width="match_parent"
45-
android:layout_height="215dp" />
46-
```
47-
48-
Then in your Activity code just launch your content.
49-
To play a video, simply call the `load(...)` method of `PlayerWebView`.
50-
51-
52-
```kotlin
53-
lateinit var playerWebView: PlayerWebView
54-
55-
override fun onCreate(savedInstanceState: Bundle?) {
56-
super.onCreate(savedInstanceState)
57-
setContentView(R.layout.screen_sample);
58-
59-
playerWebView = findViewById(R.id.playerWebview)
60-
val params = mapOf("video" to "x26hv6c")
61-
playerWebView.load(loadParams = params);
62-
}
63-
```
64-
65-
The `load(...)` method can also take additionnal parameters:
66-
```kotlin
67-
lateinit var playerWebView: PlayerWebView
68-
69-
override fun onCreate(savedInstanceState: Bundle?) {
70-
super.onCreate(savedInstanceState)
71-
setContentView(R.layout.screen_sample);
72-
73-
playerWebView = findViewById(R.id.playerWebview)
74-
val params = mapOf(
75-
"video" to "videoXId",
76-
"key2" to "value2",
77-
"key3" to "value3",
78-
)
79-
playerWebView.load(loadParams = params);
80-
}
81-
```
82-
83-
### Handle screen rotation
84-
For the screen rotation to be handled correctly, you need to add
85-
86-
```xml
87-
android:configChanges="orientation|screenSize"
88-
```
89-
90-
to any activity using PlayerWebView, in your AndroidManifest.xml
91-
92-
### Lifecycle
93-
You have to call onPause and onResume when these events occur in your lifecycle :
94-
95-
```kotlin
96-
override fun onPause() {
97-
super.onPause()
98-
playerWebview.onPause()
99-
}
100-
101-
override fun onResume() {
102-
super.onResume()
103-
playerWebview.onResume()
104-
}
105-
```
106-
107-
### OM SDK integration
108-
Open Measurement SDK from IAB is designed to facilitate third party viewability and verification measurement for ads served to web video and mobile app environments. See https://iabtechlab.com/standards/open-measurement-sdk/ for more details
109-
110-
We have integrated the SDK in our Dailymotion Player SDK and it does more or less everything out of the box :
111-
- Ad session management
112-
- Ad main signals (play, buffer_start, buffer_end, pause, resume, quartiles, click)
113-
- Device and Player volume management
114-
- ⚠️ Basic Player state handling. NORMAL or FULLSCREEN based on player fullscreen state.<br/><br/>
115-
It's **STRONGLY** recommended to update at all time the player state if your app has more player layout variety, such as mini-player, picture-in-picture, etc...<br/>
116-
To do it, simply update the OMHelper `playerState` field :
117-
```kotlin
118-
OMHelper.playerState = PlayerState.COLLAPSED
119-
```
120-
![image](https://user-images.githubusercontent.com/6400030/125312203-5ba0c700-e334-11eb-979f-6dd7e5d924ad.png)
121-
122-
### IAB TCF2
123-
The SDK follows the [IAB TCF2 standard](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework) to [access](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md#how-do-third-party-sdks-vendors-access-the-consent-information-in-app) the stored consent string.
124-
In order to pass the consent string to the player, just use those lines **after the consent string was generated** by the CMP:
125-
126-
```kotlin
127-
// Instantiate the TCF2Handler
128-
val tcf2Handler = TCF2Handler()
129-
130-
// Make the player load the consent string stored at the location determined by IAB TCF2 Standard
131-
val didLoadConsentString = tcf2Handler.loadConsentString(context = this)
132-
133-
if (didLoadConsentString) {
134-
// Successfully loaded the consent string
135-
} else {
136-
// Failed to load the consent string: check logs
137-
}
138-
```
139-
140-
### Play Services
141-
The SDK uses Google Play Services to get the [Advertising Id](https://developer.android.com/training/articles/ad-id)
142-
If your app also uses play services, you may want to override the `play-services-ads-identifier` version to avoid conflicting with other play services artifacts.
143-
144-
```
145-
dependencies {
146-
implementation 'com.google.android.gms:play-services-ads-identifier:[your_play_services_version]'
147-
}
148-
```
149-
150-
Faq
151-
---
152-
153-
**Q.** I have an only Java project and I don’t plan to move to Kotlin. How can use your sdk ?\
154-
**A.** Starting from 0.2.0, the sdk is Kotlin only however you can still use the previous sdk version which are in Java and still available.\
155-
For instance, [0.1.31](https://bintray.com/dailymotion/com.dailymotion.dailymotion-sdk-android/sdk/0.1.31) is the latest sdk using only Java.
1+
> [!WARNING]
2+
> We no longer support this SDK for Player integration on Android environments.
3+
> Please use the new Android SDK documented [here](https://developers.dailymotion.com/guides/getting-started-with-android-sdk/).

0 commit comments

Comments
 (0)