Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
R
RTSPDemo
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ubains-android-demo
RTSPDemo
Commits
0396be26
提交
0396be26
authored
6月 01, 2020
作者:
汪显鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加mjpeg 视屏解码。
上级
14fa8f98
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
102 行增加
和
23 行删除
+102
-23
build.gradle
app/build.gradle
+18
-8
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+13
-4
Main2Activity.java
app/src/main/java/com/ubains/rtspdemo/Main2Activity.java
+41
-0
MainActivity.java
app/src/main/java/com/ubains/rtspdemo/MainActivity.java
+11
-10
activity_main2.xml
app/src/main/res/layout/activity_main2.xml
+18
-0
build.gradle
build.gradle
+1
-1
没有找到文件。
app/build.gradle
浏览文件 @
0396be26
...
@@ -10,15 +10,11 @@ android {
...
@@ -10,15 +10,11 @@ android {
versionName
"1.0"
versionName
"1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
compileOptions
{
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
}
packagingOptions
{
packagingOptions
{
exclude
'lib/armeabi-v7a/libijkplayer.so'
exclude
'lib/armeabi-v7a/libijkplayer.so'
exclude
'lib/armeabi-v7a/libijkffmpeg.so'
exclude
'lib/armeabi-v7a/libijkffmpeg.so'
...
@@ -42,14 +38,14 @@ dependencies {
...
@@ -42,14 +38,14 @@ dependencies {
implementation
'com.android.support:appcompat-v7:28.0.0'
implementation
'com.android.support:appcompat-v7:28.0.0'
implementation
'com.android.support.constraint:constraint-layout:1.1.3'
implementation
'com.android.support.constraint:constraint-layout:1.1.3'
implementation
'com.shuyu:gsyVideoPlayer-java:7.
0.1
'
implementation
'com.shuyu:gsyVideoPlayer-java:7.
1.4
'
//是否需要ExoPlayer模式
//是否需要ExoPlayer模式
implementation
'com.shuyu:GSYVideoPlayer-exo2:7.0.1'
implementation
'com.shuyu:GSYVideoPlayer-exo2:7.0.1'
implementation
'com.shuyu:gsyVideoPlayer-armv7a:7.0.1'
implementation
'com.shuyu:gsyVideoPlayer-armv7a:7.0.1'
implementation
'com.shuyu:gsyVideoPlayer-java:7.0.1'
implementation
'com.shuyu:gsyVideoPlayer-java:7.0.1'
//是否需要ExoPlayer模式
//是否需要ExoPlayer模式
implementation
'com.shuyu:GSYVideoPlayer-exo2:7.0.1'
implementation
'com.shuyu:GSYVideoPlayer-exo2:7.0.1'
...
@@ -57,6 +53,20 @@ dependencies {
...
@@ -57,6 +53,20 @@ dependencies {
implementation
'com.shuyu:gsyVideoPlayer-ex_so:7.0.1'
implementation
'com.shuyu:gsyVideoPlayer-ex_so:7.0.1'
// implementation 'com.shuyu:gsyVideoPlayer-java:7.1.4'
// //是否需要ExoPlayer模式
// implementation 'com.shuyu:GSYVideoPlayer-exo2:7.1.4'
// //更多ijk的编码支持
// implementation 'com.shuyu:gsyVideoPlayer-ex_so:7.1.4'
implementation
'com.github.niqdev:mjpeg-view:1.7.0'
implementation
'androidx.appcompat:appcompat:1.1.0'
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation
'junit:junit:4.12'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
...
...
app/src/main/AndroidManifest.xml
浏览文件 @
0396be26
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
package=
"com.ubains.rtspdemo"
>
package=
"com.ubains.rtspdemo"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<application
<application
android:allowBackup=
"true"
android:allowBackup=
"true"
android:appComponentFactory=
""
android:appComponentFactory=
""
...
@@ -14,17 +15,25 @@
...
@@ -14,17 +15,25 @@
android:theme=
"@style/AppTheme"
android:theme=
"@style/AppTheme"
tools:ignore=
"GoogleAppIndexingWarning"
tools:ignore=
"GoogleAppIndexingWarning"
tools:replace=
"android:appComponentFactory"
>
tools:replace=
"android:appComponentFactory"
>
<activity
android:name=
".Main2Activity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
<activity
android:name=
".MainActivity"
android:name=
".MainActivity"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:configChanges=
"orientation|keyboardHidden|screenSize"
android:screenOrientation=
"landscape"
android:screenOrientation=
"landscape"
android:theme=
"@style/Theme.AppCompat.NoActionBar"
>
android:theme=
"@style/Theme.AppCompat.NoActionBar"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</activity>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/ubains/rtspdemo/Main2Activity.java
0 → 100644
浏览文件 @
0396be26
package
com
.
ubains
.
rtspdemo
;
import
android.os.Bundle
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.github.niqdev.mjpeg.DisplayMode
;
import
com.github.niqdev.mjpeg.Mjpeg
;
import
com.github.niqdev.mjpeg.MjpegSurfaceView
;
public
class
Main2Activity
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main2
);
Mejpeg2
();
}
private
void
Mejpeg2
()
{
MjpegSurfaceView
mjpegView
=
(
MjpegSurfaceView
)
findViewById
(
R
.
id
.
VIEW_NAME
);
int
TIMEOUT
=
5
;
//seconds
Mjpeg
.
newInstance
()
.
credential
(
""
,
""
)
.
open
(
"http://192.168.1.231/stream"
,
TIMEOUT
)
.
subscribe
(
inputStream
->
{
mjpegView
.
setSource
(
inputStream
);
mjpegView
.
setDisplayMode
(
DisplayMode
.
FULLSCREEN
);
mjpegView
.
showFps
(
true
);
});
}
}
app/src/main/java/com/ubains/rtspdemo/MainActivity.java
浏览文件 @
0396be26
package
com
.
ubains
.
rtspdemo
;
package
com
.
ubains
.
rtspdemo
;
import
android.content.pm.ActivityInfo
;
import
android.content.pm.ActivityInfo
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
...
@@ -14,7 +13,6 @@ import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager;
...
@@ -14,7 +13,6 @@ import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager;
import
com.shuyu.gsyvideoplayer.model.VideoOptionModel
;
import
com.shuyu.gsyvideoplayer.model.VideoOptionModel
;
import
com.shuyu.gsyvideoplayer.player.IjkPlayerManager
;
import
com.shuyu.gsyvideoplayer.player.IjkPlayerManager
;
import
com.shuyu.gsyvideoplayer.player.PlayerFactory
;
import
com.shuyu.gsyvideoplayer.player.PlayerFactory
;
import
com.shuyu.gsyvideoplayer.player.SystemPlayerManager
;
import
com.shuyu.gsyvideoplayer.utils.OrientationUtils
;
import
com.shuyu.gsyvideoplayer.utils.OrientationUtils
;
import
com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
;
...
@@ -51,7 +49,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -51,7 +49,7 @@ public class MainActivity extends AppCompatActivity {
private
void
init
()
{
private
void
init
()
{
videoPlayer
=
(
StandardGSYVideoPlayer
)
findViewById
(
R
.
id
.
detail_player
);
videoPlayer
=
findViewById
(
R
.
id
.
detail_player
);
List
<
VideoOptionModel
>
list
=
new
ArrayList
<>();
List
<
VideoOptionModel
>
list
=
new
ArrayList
<>();
...
@@ -62,21 +60,23 @@ public class MainActivity extends AppCompatActivity {
...
@@ -62,21 +60,23 @@ public class MainActivity extends AppCompatActivity {
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
//硬解码:1、打开,0、关闭
//硬解码:1、打开,0、关闭
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_PLAYER
,
"mediacodec"
,
1
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_PLAYER
,
"mediacodec"
,
0
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
//软解码:1、打开,0、关闭
//软解码:1、打开,0、关闭
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_PLAYER
,
"videotoolbox"
,
1
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_PLAYER
,
"videotoolbox"
,
1
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"allowed_media_types"
,
"video"
);
//根据媒体类型来配置
//根据媒体类型来配置
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"allowed_media_types"
,
"video"
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"timeout"
,
200
0
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"timeout"
,
1
0
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"buffer_size"
,
1
316
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"buffer_size"
,
1
0240
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"infbuf"
,
1
);
// 无限读
// 无限读
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"infbuf"
,
1
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"analyzemaxduration"
,
5
);
videoOptionModel
=
new
VideoOptionModel
(
IjkMediaPlayer
.
OPT_CATEGORY_FORMAT
,
"analyzemaxduration"
,
5
);
list
.
add
(
videoOptionModel
);
list
.
add
(
videoOptionModel
);
...
@@ -93,7 +93,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -93,7 +93,7 @@ public class MainActivity extends AppCompatActivity {
/**
/**
* 换成自己的流媒体地址
* 换成自己的流媒体地址
*/
*/
String
source1
=
String
.
format
(
Locale
.
ENGLISH
,
"rtsp://admin:
HZ0000001988@192.168.10.28:554/h264/ch1/main/av_stream
"
,
"192.168.10.28"
);
String
source1
=
String
.
format
(
Locale
.
ENGLISH
,
"rtsp://admin:
huawei@123@192.168.1.21/LiveMedia/ch1/Media1
"
,
"192.168.10.28"
);
//String source1 = String.format(Locale.ENGLISH, "rtsp://admin:HZ0000001988@192.168.10.21:554/h264/ch1/main/av_stream", "192.168.10.21");
//String source1 = String.format(Locale.ENGLISH, "rtsp://admin:HZ0000001988@192.168.10.21:554/h264/ch1/main/av_stream", "192.168.10.21");
videoPlayer
.
setUp
(
source1
,
true
,
"测试视频"
);
videoPlayer
.
setUp
(
source1
,
true
,
"测试视频"
);
...
@@ -145,9 +145,10 @@ public class MainActivity extends AppCompatActivity {
...
@@ -145,9 +145,10 @@ public class MainActivity extends AppCompatActivity {
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
GSYVideoManager
.
releaseAllVideos
();
GSYVideoManager
.
releaseAllVideos
();
if
(
orientationUtils
!=
null
)
if
(
orientationUtils
!=
null
)
{
orientationUtils
.
releaseListener
();
orientationUtils
.
releaseListener
();
}
}
}
@Override
@Override
public
void
onBackPressed
()
{
public
void
onBackPressed
()
{
...
...
app/src/main/res/layout/activity_main2.xml
0 → 100644
浏览文件 @
0396be26
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:stream=
"http://schemas.android.com/apk/res-auto"
tools:context=
".Main2Activity"
>
<com.github.niqdev.mjpeg.MjpegSurfaceView
android:id=
"@+id/VIEW_NAME"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
stream:type=
"stream_default"
/>
</RelativeLayout>
\ No newline at end of file
build.gradle
浏览文件 @
0396be26
...
@@ -18,7 +18,7 @@ allprojects {
...
@@ -18,7 +18,7 @@ allprojects {
repositories
{
repositories
{
google
()
google
()
jcenter
()
jcenter
()
maven
{
url
'https://jitpack.io'
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论