-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from THEOplayer/feature/ads
Basic ad support
- Loading branch information
Showing
9 changed files
with
246 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/theoplayer/android/ui/demo/Streams.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.theoplayer.android.ui.demo | ||
|
||
import androidx.compose.runtime.saveable.Saver | ||
import androidx.compose.runtime.saveable.SaverScope | ||
import com.theoplayer.android.api.source.SourceDescription | ||
import com.theoplayer.android.api.source.TypedSource | ||
import com.theoplayer.android.api.source.addescription.GoogleImaAdDescription | ||
|
||
data class Stream(val title: String, val source: SourceDescription) | ||
|
||
val streams by lazy { | ||
listOf( | ||
Stream( | ||
title = "Elephant's Dream (HLS)", | ||
source = SourceDescription.Builder( | ||
TypedSource.Builder("https://cdn.theoplayer.com/video/elephants-dream/playlist.m3u8") | ||
.build() | ||
).build() | ||
), | ||
Stream( | ||
title = "Sintel (DASH) with preroll ad", | ||
source = SourceDescription.Builder( | ||
TypedSource.Builder("https://cdn.theoplayer.com/video/dash/webvtt-embedded-in-isobmff/Manifest.mpd") | ||
.build() | ||
).ads( | ||
GoogleImaAdDescription.Builder("https://cdn.theoplayer.com/demos/ads/vast/dfp-preroll-no-skip.xml") | ||
.timeOffset("start") | ||
.build() | ||
).build() | ||
) | ||
) | ||
} | ||
|
||
object StreamSaver : Saver<Stream, Int> { | ||
override fun restore(value: Int): Stream? = streams.getOrNull(value) | ||
override fun SaverScope.save(value: Stream): Int = streams.indexOf(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.