Skip to content

Instantly share code, notes, and snippets.

@mister-ben
mister-ben / sitemap.php
Last active October 8, 2015 05:38
Basic sitemap from Brightcove media API
<?php
/*
* Basic video sitemap generator
*
* Pulls video infromation from Brightcove Media API
*
* If you have a custom field in which you store the URL on your site where the video has been
* added, the script can use that URL in the sitemap.
*
* Otherwise it assumes all videos are to be played back in a single player at same URL. The "bctid"
@mister-ben
mister-ben / opengraph.php
Created December 11, 2013 12:34
Basic example of populating Open Graph Metadata from the Video Cloud Media API This expects the video ID to be in the URL as a query parameter - bctid. Would be good to cache this as the information retrieved would be quite static. Requires PHP Media API wrapper https://github.com/BrightcoveOS/PHP-MAPI-Wrapper
<?php
$bc_player_id = '123456789'; // Player to use on Facebook - usually your viral player
$bc_player_key = 'AQ~~,AAAAABCDEFGabcdefg123456789'; // The player key for the same player
$bc_video_id = '123456789'; // Default video ID - overridden by ?bctid if present
$bc_japan_account = false; // Set to true only if a Brightcove Japan account
$bc_read_token = 'ABCDEFG123456789abcdefg123456789'; // Your read token
// https://github.com/BrightcoveOS/PHP-MAPI-Wrapper
require('bc-mapi.php');
#!/usr/bin/env ruby
# Creates a video sitemap following this spec https://support.google.com/webmasters/answer/80472?hl=en
#
# This is a proof of concept that shows mapping Media API output to the sitemap fields. It produces a
# sitemap listing every video in a Video Cloud account, and the page URLs are all the same page with
# a varying bctid URL parameter. This would instruct a video player at that page to load that
# particular video. For production use you would probably take a different approach - e.g. for
# each URL you list in your regular sitemap you'd want to look up and add the details of the video
# that's published there.
@mister-ben
mister-ben / hide_dock.sh
Created May 30, 2014 14:00
Show / hide dock on OS X
#!/usr/bin/osascript
tell application "System Events" to set the autohide of the dock preferences to true
@mister-ben
mister-ben / exitfullscreen.js
Last active August 29, 2015 14:03
Plugin for Brightcove HTML player. Exits fullscreen on stop events.
/*
Exits from iOS fullscreen on stop / pause
*/
(function() {
function onPlayerReady() {
videoPlayer.addEventListener(brightcove.api.events.MediaEvent.STOP, function(event){
$("video")[0].webkitExitFullScreen();
@mister-ben
mister-ben / html5playerlogo.js
Created September 2, 2014 12:21
Player logo overlay for Video Cloud HTML5 player. Logo can only be displayed non-fullscreen.
(function() {
function onPlayerReady() {
var overlay = videoPlayer.overlay();
$(overlay).html('<img id="overlaylogo" src="http://cs1.brightcodes.net/ben/img/genericlogo.png" />').css({
position:"fixed",
height:"100%",
width:"100%"
});
$("#overlaylogo").css({
<?php
// Brightcove sample for MRSS feed
// This is just a sample to get you started. You can customize further as your requirements
// grow.
// The following is a list of requirements and conditions in order for this podcast feed
// to function properly;
// 1) You must have a Pro or Enterprise level Video Cloud Account.
// 2) You will need to contact Brightcove Support to request an API READ Token with URL
// access, if you don't have one already.
@mister-ben
mister-ben / blockcontextmenu.js
Last active August 29, 2015 14:06
Brightcove Smart Player plugin to inhibit right-click menu within the player iframe. Prevents the user using 'save as'. This only affects the context menu - a determined user can still download an HTTP video.
/*
Inhibits the right-click menu within the smart player iframe
*/
(function() {
document.addEventListener('contextmenu',function(e){
e.preventDefault();
});
}());
@mister-ben
mister-ben / index.html
Created May 6, 2015 10:57
JS Bin Subtle skin // source http://jsbin.com/bipiga
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Subtle skin">
<meta charset="utf-8">
<title>JS Bin</title>
<link href='http://fonts.googleapis.com/css?family=Comfortaa:300' rel='stylesheet' type='text/css'>
<style id="jsbin-css">
/*Player size*/
.video-js {
@mister-ben
mister-ben / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console