Skip to content

Instantly share code, notes, and snippets.

TakuSemba TakuSemba

  • Tokyo, Japan
Block or report user

Report or block TakuSemba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ttml-example.xml
<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns:tts="http://www.w3.org/ns/ttml#styling" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" ttp:timeBase="media" ttp:frameRate="24" xml:lang="en">
<head>
<metadata>
<ttm:title>Sample TTML</ttm:title>
</metadata>
<styling>
<style xml:id="s1" tts:textAlign="center" tts:fontFamily="Arial" tts:fontSize="100%"/>
</styling>
<layout>
View Case2MediaDrmCallback.java
public final class Case2MediaDrmCallback implements MediaDrmCallback {
private final byte[] videoKeyResponse;
private final byte[] audioKeyResponse;
public DemoMediaDrmCallback() {
videoKeyResponse =
"{\"keys\":[{\"kty\":\"oct\",\"k\":\"7s2ytUnwKnyXzlDBf0lMoA\",\"kid\":\"x3/uNeUf1hWnuRr8sQkcXg\"}],\"type\":\"temporary\"}"
.getBytes();
audioKeyResponse =
View Case1MediaDrmCallback.java
public final class Case1MediaDrmCallback implements MediaDrmCallback {
private final byte[] keyResponse;
public DemoMediaDrmCallback() {
keyResponse = "{\"keys\":[{\"kty\":\"oct\",\"k\":\"7s2ytUnwKnyXzlDBf0lMoA\",\"kid\":\"x3/uNeUf1hWnuRr8sQkcXg\"}, {\"kty\":\"oct\",\"k\":\"mrt6tsxK07hsIZPa2x54bA\",\"kid\":\"BF9+zDWEjtezwBLqdhRCLw\"}],\"type\":\"temporary\"}".getBytes()
}
@Override public byte[] executeProvisionRequest(UUID uuid, ExoMediaDrm.ProvisionRequest request)
throws IOException {
View SampleMediaDrmCallback.java
public final class SampleMediaDrmCallback implements MediaDrmCallback {
private final byte[] keyResponse = "...";
@Override public byte[] executeProvisionRequest(UUID uuid, ExoMediaDrm.ProvisionRequest request)
throws IOException {
throw new UnsupportedOperationException();
}
@Override public byte[] executeKeyRequest(UUID uuid, ExoMediaDrm.KeyRequest request)
View sample.mpd
<?xml version="1.0" ?>
<MPD mediaPresentationDuration="PT2M5.933S" minBufferTime="PT4.94S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011">
<!-- Created with Bento4 mp4-dash.py, VERSION=1.8.0-628 -->
<Period>
<!-- Video -->
<AdaptationSet maxHeight="240" maxWidth="320" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1">
<ContentProtection cenc:default_KID="c77fee35-e51f-d615-a7b9-1afcb1091c5e" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/>
<SegmentTemplate initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="15360">
<SegmentTimeline>
<S d="129024"/>
View sample.kt
fun getHelloString() : String {
return "Hello, world!"
}
fun main(args : Array<String>) {
println(getHelloString())
}
View startAudioFocusGainService.sh
adb shell am startservice --ei AUDIO_REQUEST_KEY [audioRequestKey] your.package.name/com.takusemba.audiothief.AudioFocusGainService
View ExoPlayerAudioFocusExample.kt
val audioAttributes = AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
.setContentType(C.CONTENT_TYPE_MOVIE)
.build()
player?.setAudioAttributes(audioAttributes, true)
View playlist.m3u8
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/google/shaka-packager version 2453c93f91-release
#EXT-X-TARGETDURATION:17
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="video/init.mp4"
#EXTINF:11.378,
video/1.m4s
#EXT-X-DISCONTINUITY
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,AAAAoHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAIASEKu6Jx6Lz1UrvS6GpDSppdkSEG128lyxf14WuOrva79YLY4SEGR4YzefQVQQg3fnTG7A47gSEP3MPWFu3FzqmyVYWB2c048SEPPF4DYeZlSyj4BJx3iyOUYaDXdpZGV2aW5lX3Rlc3QiD3Rlc3QgY29udGVudCBpZEjj3JWbBg==",KEYID=0xABBA271E8BCF552BBD2E86A434A9A5D9,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
View EventLogger.java
EventLogger eventLogger = new EventLogger(trackSelector);
player.addListener(eventLogger);
player.addMetadataOutput(eventLogger);
player.addAudioDebugListener(eventLogger);
player.addVideoDebugListener(eventLogger);
DashMediaSource.Factory dash = new DashMediaSource
.Factory(new DefaultDashChunkSource.Factory(mediaDataSourceFactory),buildDataSourceFactory(false))
.createMediaSource(uri, handler, eventLogger);
You can’t perform that action at this time.