Share Coding

Tutorials, Problems, Stuffs …

Tag Archives: rtmp

H.264 Live Video Streaming on Actionscript 3.0 with Red5 Server

**A suggestion for you**: do not try to use flash streaming as a stable long term video publishing channel.

1. Import

import flash.media.H264VideoStreamSettings;
import flash.media.VideoStreamSettings;
import flash.media.H264Level;
import flash.media.H264Profile;

2. Variable and setting

var cam:Camera;
var camBandWidth:Number = 0;
var camQualityPersentage:Number = 90;
var camFPS:Number = 15;
var camKeyFrameInterval:Number = 35;
var camWidth:Number = 240;
var camHeight:Number = 220;

var h264Settings:H264VideoStreamSettings;

Read more of this post

Advertisements

Serve a file without Direct Link on PHP

Some videos wanted to stream to iPhone, but seems IOS do not support RTMP protocol.
But if those videos exposed on direct link, anyone can download it directly (Insecure).
Thus, the following example is a solution that serve a file without direct link to itself.

 
getFile.php

$file = '/usr/local/videos/video.mp4';
$mime_type = "video/mp4";
if ( is_file($file) ) {
	header("Content-type: $mime_type");
	if( isset($_SERVER['HTTP_RANGE']) ) {
		rangeDownload($file);
	} else {
		header("Content-Length: " . filesize($file));
		readfile($file);
	}
} else {
	// some error...
}

 
Read more of this post