Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c4b4e845
authored
Oct 27, 2016
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add artwork support to SimpleExoPlayerView + misc improvements
parent
0c8f3c72
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
60 deletions
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/MetadataUtil.java
library/src/main/java/com/google/android/exoplayer2/ui/AspectRatioFrameLayout.java
library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java
library/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java
library/src/main/res/layout/exo_playback_control_view.xml
library/src/main/res/layout/exo_simple_player_view.xml
library/src/main/res/values/attrs.xml
library/src/main/res/values/ids.xml
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/MetadataUtil.java
View file @
c4b4e845
...
...
@@ -71,36 +71,30 @@ import com.google.android.exoplayer2.util.Util;
// Standard genres.
private
static
final
String
[]
STANDARD_GENRES
=
new
String
[]
{
// These are the official ID3v1 genres.
"Blues"
,
"Classic Rock"
,
"Country"
,
"Dance"
,
"Disco"
,
"Funk"
,
"Grunge"
,
"Hip-Hop"
,
"Jazz"
,
"Metal"
,
"New Age"
,
"Oldies"
,
"Other"
,
"Pop"
,
"R&B"
,
"Rap"
,
"Reggae"
,
"Rock"
,
"Techno"
,
"Industrial"
,
"Alternative"
,
"Ska"
,
"Death Metal"
,
"Pranks"
,
"Soundtrack"
,
"Euro-Techno"
,
"Ambient"
,
"Trip-Hop"
,
"Vocal"
,
"Jazz+Funk"
,
"Fusion"
,
"Trance"
,
"Classical"
,
"Instrumental"
,
"Acid"
,
"House"
,
"Game"
,
"Sound Clip"
,
"Gospel"
,
"Noise"
,
"AlternRock"
,
"Bass"
,
"Soul"
,
"Punk"
,
"Space"
,
"Meditative"
,
"Instrumental Pop"
,
"Instrumental Rock"
,
"Ethnic"
,
"Gothic"
,
"Darkwave"
,
"Techno-Industrial"
,
"Electronic"
,
"Pop-Folk"
,
"Eurodance"
,
"Dream"
,
"Southern Rock"
,
"Comedy"
,
"Cult"
,
"Gangsta"
,
"Top 40"
,
"Christian Rap"
,
"Pop/Funk"
,
"Jungle"
,
"Native American"
,
"Cabaret"
,
"New Wave"
,
"Psychadelic"
,
"Rave"
,
"Showtunes"
,
"Trailer"
,
"Lo-Fi"
,
"Tribal"
,
"Acid Punk"
,
"Acid Jazz"
,
"Polka"
,
"Retro"
,
"Musical"
,
"Rock & Roll"
,
"Blues"
,
"Classic Rock"
,
"Country"
,
"Dance"
,
"Disco"
,
"Funk"
,
"Grunge"
,
"Hip-Hop"
,
"Jazz"
,
"Metal"
,
"New Age"
,
"Oldies"
,
"Other"
,
"Pop"
,
"R&B"
,
"Rap"
,
"Reggae"
,
"Rock"
,
"Techno"
,
"Industrial"
,
"Alternative"
,
"Ska"
,
"Death Metal"
,
"Pranks"
,
"Soundtrack"
,
"Euro-Techno"
,
"Ambient"
,
"Trip-Hop"
,
"Vocal"
,
"Jazz+Funk"
,
"Fusion"
,
"Trance"
,
"Classical"
,
"Instrumental"
,
"Acid"
,
"House"
,
"Game"
,
"Sound Clip"
,
"Gospel"
,
"Noise"
,
"AlternRock"
,
"Bass"
,
"Soul"
,
"Punk"
,
"Space"
,
"Meditative"
,
"Instrumental Pop"
,
"Instrumental Rock"
,
"Ethnic"
,
"Gothic"
,
"Darkwave"
,
"Techno-Industrial"
,
"Electronic"
,
"Pop-Folk"
,
"Eurodance"
,
"Dream"
,
"Southern Rock"
,
"Comedy"
,
"Cult"
,
"Gangsta"
,
"Top 40"
,
"Christian Rap"
,
"Pop/Funk"
,
"Jungle"
,
"Native American"
,
"Cabaret"
,
"New Wave"
,
"Psychadelic"
,
"Rave"
,
"Showtunes"
,
"Trailer"
,
"Lo-Fi"
,
"Tribal"
,
"Acid Punk"
,
"Acid Jazz"
,
"Polka"
,
"Retro"
,
"Musical"
,
"Rock & Roll"
,
"Hard Rock"
,
// These were made up by the authors of Winamp but backported into the ID3 spec.
"Folk"
,
"Folk-Rock"
,
"National Folk"
,
"Swing"
,
"Fast Fusion"
,
"Bebob"
,
"Latin"
,
"Revival"
,
"Celtic"
,
"Bluegrass"
,
"Avantgarde"
,
"Gothic Rock"
,
"Progressive Rock"
,
"Psychedelic Rock"
,
"Symphonic Rock"
,
"Slow Rock"
,
"Big Band"
,
"Chorus"
,
"Easy Listening"
,
"Acoustic"
,
"Humour"
,
"Speech"
,
"Chanson"
,
"Opera"
,
"Chamber Music"
,
"Sonata"
,
"Symphony"
,
"Booty Bass"
,
"Primus"
,
"Porn Groove"
,
"Satire"
,
"Slow Jam"
,
"Club"
,
"Tango"
,
"Samba"
,
"Folklore"
,
"Ballad"
,
"Power Ballad"
,
"Rhythmic Soul"
,
"Freestyle"
,
"Duet"
,
"Punk Rock"
,
"Drum Solo"
,
"A capella"
,
"Euro-House"
,
"Dance Hall"
,
// These were also invented by the Winamp folks but ignored by the ID3 authors.
"Goa"
,
"Drum & Bass"
,
"Club-House"
,
"Hardcore"
,
"Terror"
,
"Indie"
,
"BritPop"
,
"Negerpunk"
,
"Polsk Punk"
,
"Beat"
,
"Christian Gangsta Rap"
,
"Heavy Metal"
,
"Black Metal"
,
"Crossover"
,
"Contemporary Christian"
,
"Christian Rock"
,
"Merengue"
,
"Salsa"
,
"Thrash Metal"
,
"Anime"
,
"Jpop"
,
"Synthpop"
// These were made up by the authors of Winamp and later added to the ID3 spec.
"Folk"
,
"Folk-Rock"
,
"National Folk"
,
"Swing"
,
"Fast Fusion"
,
"Bebob"
,
"Latin"
,
"Revival"
,
"Celtic"
,
"Bluegrass"
,
"Avantgarde"
,
"Gothic Rock"
,
"Progressive Rock"
,
"Psychedelic Rock"
,
"Symphonic Rock"
,
"Slow Rock"
,
"Big Band"
,
"Chorus"
,
"Easy Listening"
,
"Acoustic"
,
"Humour"
,
"Speech"
,
"Chanson"
,
"Opera"
,
"Chamber Music"
,
"Sonata"
,
"Symphony"
,
"Booty Bass"
,
"Primus"
,
"Porn Groove"
,
"Satire"
,
"Slow Jam"
,
"Club"
,
"Tango"
,
"Samba"
,
"Folklore"
,
"Ballad"
,
"Power Ballad"
,
"Rhythmic Soul"
,
"Freestyle"
,
"Duet"
,
"Punk Rock"
,
"Drum Solo"
,
"A capella"
,
"Euro-House"
,
"Dance Hall"
,
// These were med up by the authors of Winamp but have not been added to the ID3 spec.
"Goa"
,
"Drum & Bass"
,
"Club-House"
,
"Hardcore"
,
"Terror"
,
"Indie"
,
"BritPop"
,
"Negerpunk"
,
"Polsk Punk"
,
"Beat"
,
"Christian Gangsta Rap"
,
"Heavy Metal"
,
"Black Metal"
,
"Crossover"
,
"Contemporary Christian"
,
"Christian Rock"
,
"Merengue"
,
"Salsa"
,
"Thrash Metal"
,
"Anime"
,
"Jpop"
,
"Synthpop"
};
private
static
final
String
LANGUAGE_UNDEFINED
=
"und"
;
...
...
library/src/main/java/com/google/android/exoplayer2/ui/AspectRatioFrameLayout.java
View file @
c4b4e845
...
...
@@ -17,10 +17,13 @@ package com.google.android.exoplayer2.ui;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.support.annotation.IntDef
;
import
android.util.AttributeSet
;
import
android.widget.FrameLayout
;
import
com.google.android.exoplayer2.R
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
/**
* A {@link FrameLayout} that resizes itself to match a specified aspect ratio.
...
...
@@ -28,6 +31,13 @@ import com.google.android.exoplayer2.R;
public
final
class
AspectRatioFrameLayout
extends
FrameLayout
{
/**
* Resize modes for {@link AspectRatioFrameLayout}.
*/
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
({
RESIZE_MODE_FIT
,
RESIZE_MODE_FIXED_WIDTH
,
RESIZE_MODE_FIXED_HEIGHT
})
public
@interface
ResizeMode
{}
/**
* Either the width or height is decreased to obtain the desired aspect ratio.
*/
public
static
final
int
RESIZE_MODE_FIT
=
0
;
...
...
@@ -85,12 +95,11 @@ public final class AspectRatioFrameLayout extends FrameLayout {
}
/**
* Sets the resize mode which can be of value {@link #RESIZE_MODE_FIT},
* {@link #RESIZE_MODE_FIXED_HEIGHT} or {@link #RESIZE_MODE_FIXED_WIDTH}.
* Sets the resize mode.
*
* @param resizeMode The resize mode.
*/
public
void
setResizeMode
(
int
resizeMode
)
{
public
void
setResizeMode
(
@ResizeMode
int
resizeMode
)
{
if
(
this
.
resizeMode
!=
resizeMode
)
{
this
.
resizeMode
=
resizeMode
;
requestLayout
();
...
...
library/src/main/java/com/google/android/exoplayer2/ui/PlaybackControlView.java
View file @
c4b4e845
...
...
@@ -120,7 +120,7 @@ public class PlaybackControlView extends FrameLayout {
public
PlaybackControlView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
int
layoutResource
Id
=
R
.
layout
.
exo_playback_control_view
;
int
controllerLayout
Id
=
R
.
layout
.
exo_playback_control_view
;
rewindMs
=
DEFAULT_REWIND_MS
;
fastForwardMs
=
DEFAULT_FAST_FORWARD_MS
;
showTimeoutMs
=
DEFAULT_SHOW_TIMEOUT_MS
;
...
...
@@ -132,8 +132,8 @@ public class PlaybackControlView extends FrameLayout {
fastForwardMs
=
a
.
getInt
(
R
.
styleable
.
PlaybackControlView_fastforward_increment
,
fastForwardMs
);
showTimeoutMs
=
a
.
getInt
(
R
.
styleable
.
PlaybackControlView_show_timeout
,
showTimeoutMs
);
layoutResource
Id
=
a
.
getResourceId
(
R
.
styleable
.
PlaybackControlView_controller_layout_id
,
layoutResource
Id
);
controllerLayout
Id
=
a
.
getResourceId
(
R
.
styleable
.
PlaybackControlView_controller_layout_id
,
controllerLayout
Id
);
}
finally
{
a
.
recycle
();
}
...
...
@@ -143,7 +143,7 @@ public class PlaybackControlView extends FrameLayout {
formatter
=
new
Formatter
(
formatBuilder
,
Locale
.
getDefault
());
componentListener
=
new
ComponentListener
();
LayoutInflater
.
from
(
context
).
inflate
(
layoutResource
Id
,
this
);
LayoutInflater
.
from
(
context
).
inflate
(
controllerLayout
Id
,
this
);
time
=
(
TextView
)
findViewById
(
R
.
id
.
exo_time
);
timeCurrent
=
(
TextView
)
findViewById
(
R
.
id
.
exo_time_current
);
progressBar
=
(
SeekBar
)
findViewById
(
R
.
id
.
exo_progress
);
...
...
library/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java
View file @
c4b4e845
This diff is collapsed.
Click to expand it.
library/src/main/res/layout/exo_playback_control_view.xml
View file @
c4b4e845
...
...
@@ -28,22 +28,22 @@
android:paddingTop=
"4dp"
android:orientation=
"horizontal"
>
<ImageButton
android:id=
"@
+
id/exo_prev"
<ImageButton
android:id=
"@id/exo_prev"
style=
"@style/ExoMediaButton.Previous"
/>
<ImageButton
android:id=
"@
+
id/exo_rew"
<ImageButton
android:id=
"@id/exo_rew"
style=
"@style/ExoMediaButton.Rewind"
/>
<ImageButton
android:id=
"@
+
id/exo_play"
<ImageButton
android:id=
"@id/exo_play"
style=
"@style/ExoMediaButton.Play"
/>
<ImageButton
android:id=
"@
+
id/exo_pause"
<ImageButton
android:id=
"@id/exo_pause"
style=
"@style/ExoMediaButton.Pause"
/>
<ImageButton
android:id=
"@
+
id/exo_ffwd"
<ImageButton
android:id=
"@id/exo_ffwd"
style=
"@style/ExoMediaButton.FastForward"
/>
<ImageButton
android:id=
"@
+
id/exo_next"
<ImageButton
android:id=
"@id/exo_next"
style=
"@style/ExoMediaButton.Next"
/>
</LinearLayout>
...
...
@@ -53,7 +53,7 @@
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@
+
id/exo_time_current"
<TextView
android:id=
"@id/exo_time_current"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
...
...
@@ -64,13 +64,13 @@
android:paddingEnd=
"4dp"
android:textColor=
"#FFBEBEBE"
/>
<SeekBar
android:id=
"@
+
id/exo_progress"
<SeekBar
android:id=
"@id/exo_progress"
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"32dp"
style=
"?android:attr/progressBarStyleHorizontal"
/>
<TextView
android:id=
"@
+
id/exo_time"
<TextView
android:id=
"@id/exo_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
...
...
library/src/main/res/layout/exo_simple_player_view.xml
View file @
c4b4e845
...
...
@@ -17,23 +17,28 @@
android:layout_height=
"match_parent"
android:layout_width=
"match_parent"
>
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id=
"@
+
id/exo_video_frame"
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout
android:id=
"@id/exo_video_frame"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
>
<View
android:id=
"@
+
id/exo_shutter"
<View
android:id=
"@id/exo_shutter"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/black"
/>
<com.google.android.exoplayer2.ui.SubtitleView
android:id=
"@
+
id/exo_subtitles"
<com.google.android.exoplayer2.ui.SubtitleView
android:id=
"@id/exo_subtitles"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
<View
android:id=
"@+id/exo_controller_placeholder"
<ImageView
android:id=
"@id/exo_artwork"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"fitCenter"
/>
<View
android:id=
"@id/exo_controller_placeholder"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
...
...
library/src/main/res/values/attrs.xml
View file @
c4b4e845
...
...
@@ -14,24 +14,33 @@
limitations under the License.
-->
<resources>
<!-- Must be kept in sync with AspectRatioFrameLayout -->
<attr
name=
"resize_mode"
format=
"enum"
>
<enum
name=
"fit"
value=
"0"
/>
<enum
name=
"fixed_width"
value=
"1"
/>
<enum
name=
"fixed_height"
value=
"2"
/>
</attr>
<!-- Must be kept in sync with SimpleExoPlayerView -->
<attr
name=
"surface_type"
format=
"enum"
>
<enum
name=
"none"
value=
"0"
/>
<enum
name=
"surface_view"
value=
"1"
/>
<enum
name=
"texture_view"
value=
"2"
/>
</attr>
<attr
name=
"show_timeout"
format=
"integer"
/>
<attr
name=
"rewind_increment"
format=
"integer"
/>
<attr
name=
"fastforward_increment"
format=
"integer"
/>
<attr
name=
"player_layout_id"
format=
"reference"
/>
<attr
name=
"controller_layout_id"
format=
"reference"
/>
<declare-styleable
name=
"SimpleExoPlayerView"
>
<attr
name=
"use_artwork"
format=
"boolean"
/>
<attr
name=
"use_controller"
format=
"boolean"
/>
<attr
name=
"
use_texture_view"
format=
"boolean
"
/>
<attr
name=
"
surface_type
"
/>
<attr
name=
"show_timeout"
/>
<attr
name=
"rewind_increment"
/>
<attr
name=
"fastforward_increment"
/>
<attr
name=
"resize_mode"
/>
<attr
name=
"player_layout_id"
/>
<attr
name=
"controller_layout_id"
/>
</declare-styleable>
...
...
library/src/main/res/values/ids.xml
View file @
c4b4e845
...
...
@@ -14,13 +14,19 @@
limitations under the License.
-->
<resources>
<item
name=
"exo_play"
type=
"id"
/>
<item
name=
"exo_pause"
type=
"id"
/>
<item
name=
"exo_rew"
type=
"id"
/>
<item
name=
"exo_ffwd"
type=
"id"
/>
<item
name=
"exo_prev"
type=
"id"
/>
<item
name=
"exo_next"
type=
"id"
/>
<item
name=
"exo_time"
type=
"id"
/>
<item
name=
"exo_time_current"
type=
"id"
/>
<item
name=
"exo_progress"
type=
"id"
/>
<item
name=
"exo_video_frame"
type=
"id"
/>
<item
name=
"exo_shutter"
type=
"id"
/>
<item
name=
"exo_subtitles"
type=
"id"
/>
<item
name=
"exo_artwork"
type=
"id"
/>
<item
name=
"exo_controller_placeholder"
type=
"id"
/>
<item
name=
"exo_controller"
type=
"id"
/>
<item
name=
"exo_play"
type=
"id"
/>
<item
name=
"exo_pause"
type=
"id"
/>
<item
name=
"exo_rew"
type=
"id"
/>
<item
name=
"exo_ffwd"
type=
"id"
/>
<item
name=
"exo_prev"
type=
"id"
/>
<item
name=
"exo_next"
type=
"id"
/>
<item
name=
"exo_time"
type=
"id"
/>
<item
name=
"exo_time_current"
type=
"id"
/>
<item
name=
"exo_progress"
type=
"id"
/>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment