Adding FilmOn Social TV channel support

## Adding FilmOn Social TV channel support

### Problem

This command

	livestreamer filmon.us/alkidavid

return

	error: No plugin can handle URL: filmon.us/alkidavid
	

	
	
### Solution

Adding support for http://www.filmon.us/channels




### Exception

#### Non-existing channel name

The URL http://filmon.us/no_channel return the same page as http://filmon.us/alkidavid rather than a 404

This command

	livestreamer filmon.us/no_channel

return

	error: No streams found on this URL: filmon.us/no_channel
	
by reading the channel name in this meta property

	<meta property="og:url" content="http://www.filmon.us/alkidavid" />
	
because

* it's less confusing for the user that a non-existing channel return an error rather than the default channel "alkidavid"
	
	
	
	
	
	
## Live
	
### RTMP and SWF URL

#### Default URL

The values

	RTMP_URL = "rtmp://204.107.26.73/battlecam"
	SWF_URL = "http://www.filmon.us/application/themes/base/flash/broadcast/VideoChatECCDN_debug_withoutCenteredOwner.swf"

are in this packet

	3167	6.144329000	192.168.5.130	204.107.26.73	RTMP	2009	Handshake C2 | connect('battlecam/')

	
The value

	playpath = "mp4:bc_" + room_id
	
is in this packet

	3533	7.052663000	192.168.5.130	204.107.26.73	RTMP	101	play('mp4:bc_3195397')
	
	
These packets are dentified with the Wireshark display filter

	tcp.port == 1935
	
	
	
	
#### Alternative URL

There's no known alternative RTMP or SWF URL or a known json page that return the RTMP or SWF URL


The page http://www.filmon.us/ajax accept these "action" requests

	{"has_webcam":"0","room_id":"3195397","id":1,"controller":"broadcast","action":"userWebcamAvailabilityStatusUpdate"}
	{"last_msg_id":0,"online_users":0,"room_id":"3195397","divId":1,"id":2,"controller":"broadcast","action":"getNewMessages"}
	
identified with the Wireshark display filter

	http
	
but there's not a known request that return a RTMP or SWF URL
	
	
	
#### Quality

The channel quality is called "default" because

* there are no known alternative channel qualities
	
	
	
	
## Replay

### Identification

>Would it be possible to either support the "replay" video stream or simply return no streams on such channels?

Not with my knowledge because I fail to distinguish between the "live" and "replay" mode because


I don't see information in a replay channel

	curl http://www.filmon.us/pricelessone_p1 > pricelessone_p1_replay.html
	
that identify that the channel is in "replay" rather than "live" mode


### RTMP and SWF URL

>Would it be possible to either support the "replay" video stream …

Not with my knowledge because I fail to download a replay video with rtmpdump because


A replay mode [channel](http://www.filmon.us/pricelessone_p1) return this in Wireshark

	3586	7.770991000	192.168.5.130	204.107.26.72	RTMP	2017	Handshake C2 | connect('battlecam/')
	Property 'tcUrl' String 'rtmp://204.107.26.72/battlecam/'
	Property 'swfUrl' String 'http://www.filmon.us/application/themes/base/flash/broadcast/VideoChatECCDN_debug_withoutCenteredOwner.swf?v=42'
	
	4019	8.899760000	192.168.5.130	204.107.26.72	RTMP	101	play('mp4:bc_3275555')
	
	4739	11.972321000	192.168.5.130	204.107.26.72	RTMP	2017	Handshake C2 | connect('battlecam/')
	Property 'swfUrl' String 'http://www.filmon.us/application/themes/base/flash/broadcast/VideoChatECCDN_debug_withoutCenteredOwner.swf?v=42'
	Property 'tcUrl' String 'rtmp://204.107.26.72/battlecam/'
	
	2021	8.546018000	192.168.5.130	204.107.26.72	RTMP	2017	Handshake C2 | connect('battlecam/')
	Property 'swfUrl' String 'http://www.filmon.us/application/themes/base/flash/broadcast/VideoChatECCDN_debug_withoutCenteredOwner.swf?v=42'
	Property 'tcUrl' String 'rtmp://204.107.26.72/battlecam/'
	
	4864	12.878280000	192.168.5.130	204.107.26.72	RTMP	98	play('bc_3275555o')
	4866	12.878416000	192.168.5.130	204.107.26.72	RTMP	98	play('bc_3275555s')
	
but these streams can't be played with rtmpdump because the commands

	swfUrl="http://www.filmon.us/application/themes/base/flash/broadcast/VideoChatECCDN_debug_withoutCenteredOwner.swf"
	rtmpdump -r "rtmp://204.107.26.72/battlecam/bc_3275555o" -s "$swfUrl" -b 0 -o video.flv
	rtmpdump -r "rtmp://204.107.26.72/battlecam/bc_3275555o" -s "$swfUrl" -V -b 0 -o video.flv

return

	RTMPDump v2.4
	(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
	Connecting ...
	INFO: Connected...

	
	
	
## Plugin name

The plugin name can be

* filmon_us.py or battlecam.py
* Filmon_us or Battlecam

because

* the streaming service was called [Battlecam](http://www.battlecam.com) when created in 2010 and since 2011 also called FilmOn [Social TV](http://www.filmon.us/channels) in a link at [FilmOn](http://www.filmon.us) that return a [page](http://www.filmon.us) with the title FilmOn rather than Battlecam


I select the name filmon_us.py rather than battlecam.py because

* FilmOn Social TV is a newer name for the service than Battlecam