Skip to content

Instantly share code, notes, and snippets.

@deepak-pk
deepak-pk / process-all.js
Created July 4, 2018 13:22 — forked from ciromattia/process-all.js
Simple captions with vtt.js and a sample video.
var video = document.querySelector('video');
var caption = video.querySelector('track[kind=captions]');
var captionsArea = document.querySelector('.captions-area');
var captionsDisplay = document.querySelector('.captions-display');
var xhr = new XMLHttpRequest();
xhr.open('GET', caption.src);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
[
{
"id": "57597",
"channel": "b02f7c3972ece2972db321d9d4bea5df",
"tag": "d01fbe2f6c65e93d8844fa23c9e5b393",
"logo": "https://titantv.com/Logos/f/img_5849_Primary.png",
"name": "channel A",
"program": [
{
"id": "i1",
@deepak-pk
deepak-pk / menu
Last active November 16, 2017 14:36
{
"menu": [
{
"id": "1",
"name": "Home"
},
{
"id": "2",
"name": "Drama"
},
@deepak-pk
deepak-pk / media
Last active November 17, 2017 10:07
{
"categories": [
{
"name": "FEATURED",
"videos": [
{
"description": "Rogue One: A Star Wars Story, or simply Rogue One, is a 2016 American epic space opera film directed by Gareth Edwards. The screenplay by Chris Weitz and Tony Gilroy is from a story by John Knoll and Gary Whitta. It was produced by Lucasfilm and distributed by Walt Disney Studios Motion Pictures. It is the first installment of the Star Wars Anthology series, set immediately before the events of the original Star Wars film. The cast includes Felicity Jones, Diego Luna, Riz Ahmed, Ben Mendelsohn, Donnie Yen, Mads Mikkelsen, Alan Tudyk, Jiang Wen and Forest Whitaker. Rogue One follows a group of rebels on a mission to steal the plans for the Death Star, the Galactic Empire's superweapon. Based on an idea first pitched by Knoll ten years before it entered development, the film was made to be different in tone and style from the traditional Star Wars films.",
"sources": [
"https://s3-ap-
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@deepak-pk
deepak-pk / OkHttpProgressGlideModule.java
Created August 14, 2017 18:33 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}