Skip to content

Commit

Permalink
add stat info
Browse files Browse the repository at this point in the history
  • Loading branch information
sujia committed Oct 25, 2016
1 parent 2f607db commit be8fdf9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
Binary file modified HTTPCacheDemo/app/libs/libksyhttpcache-proguard.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
import android.widget.Toast;

import com.kingsoft.media.httpcache.KSYProxyService;
import com.kingsoft.media.httpcache.stats.OnLogEventListener;


public class SettingFragment extends Fragment implements View.OnClickListener,RadioGroup.OnCheckedChangeListener{
public class SettingFragment extends Fragment implements View.OnClickListener,RadioGroup.OnCheckedChangeListener
, OnLogEventListener {


private SharedPreferences settings ;
Expand Down Expand Up @@ -114,6 +116,7 @@ public void onClick(View view) {
switch(view.getId()){
case R.id.btn_clean:
proxy = App.getKSYProxy(getActivity());
proxy.registerLogEventListener(this);
proxy.startServer();
proxy.cleanCaches();
proxy.shutDownServer();
Expand Down Expand Up @@ -150,4 +153,9 @@ public void onCheckedChanged(RadioGroup radioGroup, int i) {
editor.commit();

}

@Override
public void onLogEvent(String log) {
Log.d("cachetest", "stat log: " + log);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
HashMap<String,String> map1 = new HashMap<String,String>();
HashMap<String,String> map2 = new HashMap<String,String>();
HashMap<String,String> map3 = new HashMap<String,String>();
HashMap<String,String> map4 = new HashMap<String,String>();

map1.put("url","http://cxy.kssws.ks-cdn.com/h265_56c26b7a7dc5f6043.mp4");
map1.put("url","http://test.live.ks-cdn.com/live/test_sujia.flv");
map2.put("url","http://zbvideo.ks3-cn-beijing.ksyun.com/record/live/101743_1466076252/hls/101743_1466076252.m3u8");
map3.put("url","https://mvvideo5.meitudata.com/571090934cea5517.mp4");
map4.put("url","http://kss.ksyun.com/eflakee/FLV/15702274_1474868965.flv");

urllist.add(map1);
urllist.add(map2);
urllist.add(map3);
urllist.add(map4);

View view = inflater.inflate(R.layout.fragment_url, container, false);
listView = (ListView)view.findViewById(R.id.list_url);
SimpleAdapter adapter = new SimpleAdapter(getActivity(),urllist,R.layout.urllist_view,new String[]{"url"},new int[]{R.id.list_url_txt});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.kingsoft.media.httpcache.KSYProxyService;
import com.kingsoft.media.httpcache.OnCacheStatusListener;
import com.kingsoft.media.httpcache.OnErrorListener;
import com.kingsoft.media.httpcache.stats.OnLogEventListener;
import com.ksyun.media.player.IMediaPlayer;
import com.ksyun.media.player.KSYMediaMeta;
import com.ksyun.media.player.KSYMediaPlayer;
Expand All @@ -49,7 +50,7 @@
* 2015/5/19.
*/
public class VideoPlayerActivity extends Activity implements TextureView.SurfaceTextureListener,View.OnClickListener,
OnCacheStatusListener, OnErrorListener {
OnCacheStatusListener, OnErrorListener, OnLogEventListener {

private static final String TAG = "VideoPlayerActivity";

Expand Down Expand Up @@ -780,6 +781,7 @@ protected void startcache(){
proxy = App.getKSYProxy(this);
proxy.registerCacheStatusListener(this, mDataSource);
proxy.registerErrorListener(this);
proxy.registerLogEventListener(this);
choosecache= settings.getString("choose_cache","undefind");
if(choosecache.equals(Settings.USENUM)){
proxy.setMaxFilesCount(500);
Expand All @@ -796,16 +798,21 @@ protected void startcache(){

@Override
public void OnCacheStatus(String url, long sourceLength, int percentsAvailable) {
Log.d(TAG+"aa", String.format("OnCacheStatus listener percents: %d, sourceLength: %d, url: %s",
Log.d("cachetest", String.format("OnCacheStatus listener percents: %d, sourceLength: %d, url: %s",
percentsAvailable, sourceLength, url));
cachelength = (int)length*percentsAvailable/100;
Log.e("cachedtest","cachelength: "+cachelength);
Log.d("cachetest","cached length: "+cachelength);
this.cachePercents = percentsAvailable;
mPlayerSeekbar.setSecondaryProgress(percentsAvailable);
}

@Override
public void OnError(int errCode) {
Log.d(TAG+"aa", "onError listener " + errCode);
Log.d("cachetest", "onError listener " + errCode);
}

@Override
public void onLogEvent(String log) {
Log.d("cachetest", "stat log: "+log);
}
}
Binary file modified libs/libksyhttpcache-proguard.jar
Binary file not shown.

0 comments on commit be8fdf9

Please sign in to comment.