Integrate Web Video Caster® into your app

Do you want to let your Android users cast videos to the TV but don’t want the extra work of integrating your app with all those different TVs and other streaming devices?

Don’t worry, you can share videos from your app to Web Video Caster® and let Web Video Caster® handle all that.

Android and iOS custom url scheme

To share a video just call our custom url scheme like this:

wvc-x-callback://open?url=http%3A%2F%2Fmyvideoaddress.com
copy

Just replace your video url there and you are done! But don't forget to url encode all param values, including the url.

Want to pass headers or control url visibility?

Headers (multiple allowed):
&header=HEADER_NAME1:%20HEADER_VALUE1&header=HEADER_NAME2:%20HEADER_VALUE2
copy
Hide video address and restrict other operations:
&secure_uri=true
copy

Android Intents (the preferred method for Android apps)

The simplest way to share a video is:

String videoURL = "https://media.w3.org/2010/05/sintel/trailer.mp4";
Intent shareVideo = new Intent(Intent.ACTION_VIEW);
shareVideo.setDataAndType(Uri.parse(videoURL), "video/*");
shareVideo.setPackage("com.instantbits.cast.webvideo");
try {
startActivity(shareVideo);
} catch (ActivityNotFoundException ex) {
// Open Play Store if it fails to launch the app because the package doesn't exist.
// Alternatively you could use PackageManager.getLaunchIntentForPackage() and check for null.
// You could try catch this and launch the Play Store website if it fails but this shouldn’t
// fail unless the Play Store is missing.
Intent intent = new Intent(Intent.ACTION_VIEW);
String uriString = "market://details?id=com.instantbits.cast.webvideo" ;
intent.setData(Uri.parse(uriString));
startActivity(intent);
}
copy

Just replace videoURL with your video and you are done!


Want extra control? Web Video Caster® will accept subtitles, headers, and more.

Subtitles:
shareVideo.putExtra("subtitle", "replace with subtitle url");
copy
or:
shareVideo.putExtra("subs", new Uri[]{Uri.parse("http://subtitleserver.com/subtitlefile.srt")});
copy
or:
shareVideo.putExtra("subs.filename", new Uri[]{Uri.parse("http://subtitleserver.com/subtitlefile.srt")});
copy
Video title:
shareVideo.putExtra("title", "this is the title of the video");
copy
Video poster url:
shareVideo.putExtra("poster", "http://posterurl");
copy
Headers:
Bundle headers = new Bundle();
headers.putString("Referer", "http://somereferrer");
headers.putString("Cookie", "some cookie");
headers.putString("User-Agent", "user agent string");
shareVideo.putExtra("android.media.intent.extra.HTTP_HEADERS",headers);
copy
or pass an array with name being index i and value being i+1:
String[] headers = {"Referer", "http://somereferrer", "Cookie", "some cookie", "User-Agent", "user agent string"};
shareVideo.putExtra("headers",headers);
copy
Hide video address and restrict other operations:
shareVideo.putExtra("secure_uri", true);
copy

Complete example:

String videoURL = "https://media.w3.org/2010/05/sintel/trailer.mp4";
Intent shareVideo = new Intent(Intent.ACTION_VIEW);
shareVideo.setDataAndType(Uri.parse(videoURL), "video/*");
shareVideo.setPackage("com.instantbits.cast.webvideo");
shareVideo.putExtra("subtitle", "http://subtitleserver.com/subtitlefile.srt");
shareVideo.putExtra("title", "this is the title of the video");
shareVideo.putExtra("poster", "http://posterurl");
Bundle headers = new Bundle();
headers.putString("Referer", "http://somereferrer");
headers.putString("Cookie", "some cookie");
headers.putString("User-Agent", "user agent string");
shareVideo.putExtra("android.media.intent.extra.HTTP_HEADERS", headers);
shareVideo.putExtra("secure_uri", true);
try {
startActivity(shareVideo);
} catch (ActivityNotFoundException ex) {
// Open Play Store if it fails to launch the app because the package doesn't exist.
// Alternatively you could use PackageManager.getLaunchIntentForPackage() and check for null.
// You could try catch this and launch the Play Store website if it fails but this shouldn’t
// fail unless the Play Store is missing.
Intent intent = new Intent(Intent.ACTION_VIEW);
String uriString = "market://details?id=com.instantbits.cast.webvideo" ;
intent.setData(Uri.parse(uriString));
startActivity(intent);
}
copy
Need some other functionality? Don’t hesitate to contact us.