All Projects → averyzhong → Subtitleforandroid

averyzhong / Subtitleforandroid

Subtitle For Android is a multi-subtitle support library for Android platform video playback. It supports almost all Android versions, and supports subtitle files in. SRT,. SCC,. ASS,. STL,. TTML formats.

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Subtitleforandroid

Subsync
Automatically download subtitles for your movies
Stars: ✭ 270 (+365.52%)
Mutual labels:  subtitle
Sickgear
SickGear has proven the most reliable stable TV fork of the great Sick-Beard to fully automate TV enjoyment with innovation.
Stars: ✭ 452 (+679.31%)
Mutual labels:  subtitle
Subfinder
字幕查找器
Stars: ✭ 545 (+839.66%)
Mutual labels:  subtitle
Ass
A JavaScript ASS subtitle format renderer
Stars: ✭ 356 (+513.79%)
Mutual labels:  subtitle
Cs231n 17 kor sub
CS231N 2017 video subtitles translation project for Korean Computer Science students
Stars: ✭ 409 (+605.17%)
Mutual labels:  subtitle
Youtube Transcript Api
This is a python API which allows you to get the transcript/subtitles for a given YouTube video. It also works for automatically generated subtitles and it does not require a headless browser, like other selenium based solutions do!
Stars: ✭ 495 (+753.45%)
Mutual labels:  subtitle
subslider.js
A script to fix out of sync subtitles - in javascript
Stars: ✭ 16 (-72.41%)
Mutual labels:  subtitle
Getsubtitles
一步下载匹配字幕
Stars: ✭ 686 (+1082.76%)
Mutual labels:  subtitle
Alass
"Automatic Language-Agnostic Subtitle Synchronization"
Stars: ✭ 421 (+625.86%)
Mutual labels:  subtitle
Ffsubsync
Automagically synchronize subtitles with video.
Stars: ✭ 5,167 (+8808.62%)
Mutual labels:  subtitle
Bilili
🍻 bilibili video (including bangumi) and danmaku downloader | B站视频(含番剧)、弹幕下载器
Stars: ✭ 379 (+553.45%)
Mutual labels:  subtitle
Sushi
Automatic subtitle shifter based on audio
Stars: ✭ 407 (+601.72%)
Mutual labels:  subtitle
Youtube Auto Subtitle Download
☕️ Youtube 字幕下载,Download Youtube Subtitles (Work best on Chrome + Tampermonkey) 2020-10-7 更新:支持中英双语字幕下载,请在页面底部提供的另一个链接进行安装
Stars: ✭ 500 (+762.07%)
Mutual labels:  subtitle
Go Astisub
Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)
Stars: ✭ 305 (+425.86%)
Mutual labels:  subtitle
Translate Subtitle File
🤖 字幕组机翻小助手 - 【功能1:翻译字幕文件】 .srt .ass .vtt 【功能2:语音转文字】(拖入视频或音频识别出字幕) (最新版 v4.1.0 更新时间2021年2月23号) 可配置12家翻译服务商,如谷歌,百度,腾讯,彩云,IBM,Azure,Amazon等(可配置6家语音服务商:阿里云,讯飞,腾讯云,IBM,Azure,Amazon )优点:1. 可以用多家服务商,2. 自己配 API Key 用自己账户的免费额度,比如腾讯每月有500万字符的免费翻译额度,IBM 500分钟的语音转文字免费额度(tern.best 那个域名过期了我不想续费了)
Stars: ✭ 579 (+898.28%)
Mutual labels:  subtitle
LycricsTextView
No description or website provided.
Stars: ✭ 14 (-75.86%)
Mutual labels:  subtitle
Artplayer
🎨 ArtPlayer.js is a modern and full featured HTML5 video player
Stars: ✭ 484 (+734.48%)
Mutual labels:  subtitle
Fasubrip
FaSubrip autodetects and converts encoding of farsi (persian) subrip files. with additional functionalities.
Stars: ✭ 22 (-62.07%)
Mutual labels:  subtitle
Videoshow
Simple node.js utility to create video slideshows from images with optional audio and visual effects using ffmpeg
Stars: ✭ 618 (+965.52%)
Mutual labels:  subtitle
Subplayer
📝 SubPlayer is a online subtitle editor
Stars: ✭ 517 (+791.38%)
Mutual labels:  subtitle

CSDN blog: https://blog.csdn.net/han_han_1/article/details/86747472

Download

Android外挂字幕组件库(Subtitle For Android)

概述

Subtitle For Android 是一个Android平台视频播放多字幕支持库,几乎支持所有的Android版本,可以在需要外挂字幕中的项目集成。支持的字幕格式有:.SRT、.SCC、.ASS、.STL、.TTML格式的字幕文件。集成方式简单,可几行代码就可以使你的播放器支持外挂做字幕的支持

下载

implementation 'com.avery:subtitle:1.0.6' // 最新版本号请看上面"Download"气泡后面的数字

如果Gradle同步出现如下错误: Manifest merger failed : uses-sdk:minSdkVersion xx cannot be smaller than version xx declared in library [com.avery:subtitle:x.x.x]

请在AndroidManifest.xml中加入<uses-sdk tools:overrideLibrary="com.avery.subtitle"/>

怎样使用?

  1. 在播放器布局文件中添加SimpleSubtitleView
<com.avery.subtitle.widget.SimpleSubtitleView
        android:id="@+id/subtitle_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center"
        android:text="字幕将在这里显示"
        android:textColor="#ffffff"
        android:textSize="26sp"
        android:textStyle="bold"/>

  1. 绑定MediaPlayerSimpleSubtitleView
  private SimpleSubtitleView mSubtitleView;

   ....省略无关代码.....

  mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
             @Override
             public void onPrepared(final MediaPlayer mp) {
                 // 绑定MediaPlayer
                 mSubtitleView.bindToMediaPlayer(mp);
                 // 设置字幕
                 mSubtitleView.setSubtitlePath(SUBTITLE_URL);
             }
         });
   mVideoView.setVideoURI(Uri.parse(VIDEO_URL));

    ....省略无关代码.....


   @Override
   protected void onDestroy() {
         mSubtitleView.destroy(); // 记得销毁
         super.onDestroy();
   }

SimpleSubtitleView还有其他与Activity生命周期相似的方法:start()pause()resume()stop()reset() 可以根据具体集成情况在适当的地方进行调用。

字幕样式设置

SimpleSubtitleView继承自TextView,所以TextView的所有样式设置都适用于SimpleSubtitleView,如设置字幕颜色、字幕大小、字幕对其方式等。

注意!!!

  1. 最好在MediaPlayer初始化完成后才能调用SimpleSubtitleView.setSubtitlePath()方法,最好的时机是在MediaPlayer的onPrepared回调方法里调用SimpleSubtitleView.setSubtitlePath()
  2. 最好在MediaPlayer销毁之前先销毁SimpleSubtitleView,即调用SimpleSubtitleView.destroy(),最好的时机是在调用MediaPlayer.release()方法前先调用调用SimpleSubtitleView.destroy()

自定义字幕显示控件

如果不想使用提供的SimpleSubtitleView控件,你还可以轻松自定义你自己的显示控件,只需通过 DefaultSubtitleEngine来辅助就能办到

....
 private SubtitleEngine mSubtitleEngine = new DefaultSubtitleEngine();

 mSubtitleEngine.setOnSubtitlePreparedListener(new OnSubtitlePreparedListener() {
        @Override
        public void onSubtitlePrepared(@Nullable final List<Subtitle> subtitles) {
                // 启动字幕刷新任务
                mSubtitleEngine.start();
           }
        });

 mSubtitleEngine.setOnSubtitleChangeListener(new OnSubtitleChangeListener() {
        @Override
         public void onSubtitleChanged(@Nullable final Subtitle subtitle) {
                // 拿到Subtitle对象来刷新你自定义过的字幕显示控件,注意subtitle可能为空
                // 当subtitle为空时,你应该清除自定义控件已显示的字幕显示
                .......
           }
        });
....

自定义的最后一步就是通过DefaultSubtitleEngine的生命周期相应方法:start()pause()resume()stop()reset()处理好控件的生命周期,以免导致bug。

快照

License

Copyright 2019 AveryZhong

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].