Browse Source

Add support for custom source

Seiya Konno 8 years ago
parent
commit
c099c0fc0d
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/player.js

+ 5 - 1
src/player.js View File

@@ -3,7 +3,11 @@ JSMpeg.Player = (function(){ "use strict";
3 3
 var Player = function(url, options) {
4 4
 	this.options = options || {};
5 5
 
6
-	if (url.match(/^wss?:\/\//)) {
6
+	if (options.source) {
7
+		this.source = new options.source(url, options);
8
+		options.streaming = !!this.source.streaming;
9
+	}
10
+	else if (url.match(/^wss?:\/\//)) {
7 11
 		this.source = new JSMpeg.Source.WebSocket(url, options);
8 12
 		options.streaming = true;
9 13
 	}