CourseServiceImp.kt 1.34 KB
Newer Older
严久程 committed
1 2 3 4
package com.yidianling.course.modular_service

import android.app.Activity
import android.content.Context
严久程 committed
5
import com.alibaba.android.arouter.facade.annotation.Route
严久程 committed
6 7
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
严久程 committed
8
import com.ydl.course.api.ICourseService
严久程 committed
9 10 11 12 13 14 15 16 17 18
import com.yidianling.course.courseNew.CourseTopicActivity
import com.yidianling.course.flutterPlugin.CourseSendPlugin

/**
 * @author jiucheng
 * @描述:
 * @Copyright Copyright (c) 2018
 * @Company 壹点灵
 * @date 2019/11/12
 */
严久程 committed
19
@Route(path = "/course/CourseService")
严久程 committed
20
class CourseServiceImp : ICourseService {
严久程 committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    override fun courseTopic(activity: Activity, id: String) {
        CourseTopicActivity.start(activity, id)
    }

    override fun closePlayer() {
        if (AudioPlayer.get().isPlaying){
            AudioPlayer.get().stopPlayer()
        }
    }

    override fun isPlaying(): Boolean {
        return AudioPlayer.get().isPlaying
    }

    override fun startCoursePlayPage(activity: Activity, from: Int) {
        PlayerFloatHelper.startCoursePlayActivity(activity,from)
    }

    override fun play() {
        AudioPlayer.get().play()
    }

    override fun pause() {
        AudioPlayer.get().playPause()
    }

    override fun sendLoginStatusToFlutter() {
        CourseSendPlugin.sendLoginSuccess()
    }

    override fun init(context: Context?) {
    }
}