Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat use ParsingMedia to manage Player and TextureView
- Loading branch information
Showing
27 changed files
with
177 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
parsingplayer/src/main/java/com/hustunique/parsingplayer/player/media/ParsingMedia.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.hustunique.parsingplayer.player.media; | ||
|
||
import android.content.Context; | ||
import android.net.Uri; | ||
import android.view.Surface; | ||
import android.view.SurfaceHolder; | ||
|
||
import com.hustunique.parsingplayer.player.io.LoadingCallback; | ||
import com.hustunique.parsingplayer.player.view.TextureRenderView; | ||
|
||
import java.io.FileDescriptor; | ||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import tv.danmaku.ijk.media.player.BuildConfig; | ||
import tv.danmaku.ijk.media.player.MediaInfo; | ||
import tv.danmaku.ijk.media.player.misc.IMediaDataSource; | ||
import tv.danmaku.ijk.media.player.misc.ITrackInfo; | ||
|
||
/** | ||
* Created by CoXier on 17-2-19. | ||
*/ | ||
|
||
public class ParsingMedia { | ||
|
||
private IParsingPlayer mPlayer; | ||
private TextureRenderView mRenderView; | ||
|
||
private static ParsingMedia mManager; | ||
|
||
private ParsingMedia(Context context){ | ||
mPlayer = createPlayer(context); | ||
} | ||
|
||
public static ParsingMedia getInstance(Context context){ | ||
if (mManager == null) | ||
mManager = new ParsingMedia(context); | ||
return mManager; | ||
} | ||
|
||
public void configurePlayer(IParsingPlayer player){ | ||
mPlayer = player; | ||
} | ||
|
||
public void configureRenderView(TextureRenderView renderView){ | ||
mRenderView = renderView; | ||
} | ||
|
||
public IParsingPlayer getPlayer(){ | ||
return mPlayer; | ||
} | ||
|
||
public TextureRenderView getRenderView(){ | ||
return mRenderView; | ||
} | ||
|
||
private IParsingPlayer createPlayer(Context context) { | ||
IParsingPlayer iParsingPlayer = new ParsingPlayer(context); | ||
iParsingPlayer.setOnPreparedListener(mPreparedListener); | ||
iParsingPlayer.setOnVideoSizeChangedListener(mSizeChangedListener); | ||
iParsingPlayer.setOnCompletionListener(mCompletionListener); | ||
iParsingPlayer.setOnErrorListener(mErrorListener); | ||
iParsingPlayer.setOnInfoListener(mInfoListener); | ||
iParsingPlayer.setOnBufferingUpdateListener(mBufferingUpdateListener); | ||
iParsingPlayer.setOnSeekCompleteListener(mSeekCompleteListener); | ||
return iParsingPlayer; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.