Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-13 10:05:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
019b25ea301fc5791540ed2f5d0ed5ec253ac3f6
019b25ea
1 parent
3a1b3dd1
add MIT license to bandwidth check/test as/js library.
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
108 行增加
和
42 行删除
trunk/research/players/srs_bwt/src/SrsBandwidth.as
trunk/research/players/srs_bwt/src/srs.bandwidth.js
trunk/research/players/srs_bwt/src/srs_bwt.as
trunk/research/players/srs_bwt/src/SrsBandwidth.as
查看文件 @
019b25e
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
{
import
flash
.
events
.
NetStatusEvent
;
...
...
@@ -42,9 +64,9 @@ package
/**
* constructor, do nothing
*/
public
function
SrsBandwidth
()
{
}
public
function
SrsBandwidth
()
{
}
/**
* initialize the bandwidth test tool, the callbacks. null to ignore.
...
...
trunk/research/players/srs_bwt/src/srs.bandwidth.js
查看文件 @
019b25e
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* the SrsBandwidth library for js to do bandwidth test.
* @param container the html container id.
...
...
trunk/research/players/srs_bwt/src/srs_bwt.as
查看文件 @
019b25e
/*
The MIT License (MIT)
Copyright (c) 2013-2014 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
{
import
flash
.
display
.
LoaderInfo
;
import
flash
.
display
.
Sprite
;
import
flash
.
display
.
StageAlign
;
import
flash
.
display
.
StageScaleMode
;
import
flash
.
events
.
Event
;
import
flash
.
events
.
NetStatusEvent
;
import
flash
.
events
.
TimerEvent
;
import
flash
.
external
.
ExternalInterface
;
import
flash
.
net
.
NetConnection
;
import
flash
.
net
.
ObjectEncoding
;
import
flash
.
system
.
System
;
import
flash
.
ui
.
ContextMenu
;
import
flash
.
ui
.
ContextMenuItem
;
import
flash
.
utils
.
Timer
;
import
flash
.
utils
.
setTimeout
;
public
class
srs_bwt
extends
Sprite
{
import
flash
.
display
.
LoaderInfo
;
import
flash
.
display
.
Sprite
;
import
flash
.
display
.
StageAlign
;
import
flash
.
display
.
StageScaleMode
;
import
flash
.
events
.
Event
;
import
flash
.
events
.
NetStatusEvent
;
import
flash
.
events
.
TimerEvent
;
import
flash
.
external
.
ExternalInterface
;
import
flash
.
net
.
NetConnection
;
import
flash
.
net
.
ObjectEncoding
;
import
flash
.
system
.
System
;
import
flash
.
ui
.
ContextMenu
;
import
flash
.
ui
.
ContextMenuItem
;
import
flash
.
utils
.
Timer
;
import
flash
.
utils
.
setTimeout
;
public
class
srs_bwt
extends
Sprite
{
/**
* the SRS bandwidth check/test library object.
...
...
@@ -27,9 +49,9 @@ package
* when not specifies any param, directly run the swf.
*/
private
var
default_url
:
String
=
"rtmp://dev:1935/app?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com"
;
public
function
srs_bwt
()
{
public
function
srs_bwt
()
{
if
(
!
this
.
stage
)
{
this
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
this
.
system_on_add_to_stage
)
;
}
else
{
...
...
@@ -37,8 +59,8 @@ package
}
}
private
function
system_on_add_to_stage
(
evt
:
Event
)
:
void
{
this
.
stage
.
scaleMode
=
StageScaleMode
.
NO_SCALE
;
this
.
stage
.
align
=
StageAlign
.
TOP_LEFT
;
this
.
stage
.
scaleMode
=
StageScaleMode
.
NO_SCALE
;
this
.
stage
.
align
=
StageAlign
.
TOP_LEFT
;
// init context menu
var
myMenu
:
ContextMenu
=
new
ContextMenu
()
;
...
...
@@ -52,7 +74,7 @@ package
private
function
check_bandwidth
()
:
void
{
// closure
var
self
:
srs_bwt
=
this
;
/////////////////////////////////////////////////////////////////////
// initialize the bandwidth check/test library
/////////////////////////////////////////////////////////////////////
...
...
@@ -130,18 +152,18 @@ package
}
contextMenu
.
customItems
=
customItems
;
}
public
function
on_status_change
(
code
:
String
,
data
:
String
)
:
void
{
trace
(
code
)
;
switch
(
code
){
case
"NetConnection.Connect.Failed"
:
public
function
on_status_change
(
code
:
String
,
data
:
String
)
:
void
{
trace
(
code
)
;
switch
(
code
){
case
"NetConnection.Connect.Failed"
:
trace
(
"连接服务器失败!"
)
;
break
;
case
"NetConnection.Connect.Rejected"
:
break
;
case
"NetConnection.Connect.Rejected"
:
trace
(
"服务器拒绝连接!"
)
;
break
;
case
"NetConnection.Connect.Success"
:
break
;
case
"NetConnection.Connect.Success"
:
trace
(
"连接服务器成功!"
)
;
break
;
break
;
case
SrsBandwidth
.
StatusSrsBwtcPlayStart
:
trace
(
"开始测试下行带宽"
)
;
break
;
...
...
@@ -154,11 +176,11 @@ package
case
SrsBandwidth
.
StatusSrsBwtcPublishStop
:
trace
(
"上行带宽测试完毕,"
+
data
+
"kbps,"
)
;
break
;
case
"NetConnection.Connect.Closed"
:
trace
(
"连接已断开!"
)
;
break
;
}
}
case
"NetConnection.Connect.Closed"
:
trace
(
"连接已断开!"
)
;
break
;
}
}
private
function
on_complete
(
start_time
:
Number
,
end_time
:
Number
,
play_kbps
:
Number
,
publish_kbps
:
Number
,
play_bytes
:
Number
,
publish_bytes
:
Number
,
play_time
:
Number
,
publish_time
:
Number
...
...
@@ -167,5 +189,5 @@ package
+
" 测试时间: "
+
Number
((
end_time
-
start_time
)
/
1000
).
toFixed
(
1
)
+
" 秒"
;
trace
(
status
)
;
}
}
}
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论