定制 sajed-zarinpour/spotplayer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sajed-zarinpour/spotplayer

Composer 安装命令:

composer require sajed-zarinpour/spotplayer

包简介

A wrapper for spotplayer.ir video service (DRM) API.

README 文档

README

Laravel wrapper for spotplayer.ir video service (DRM) API

This package provides an API wrapper for spotplayer.ir website. Spotplayer is a video-sharing website for teachers that provides a way to stream their video on either their website or the Spotplayer application (which is available for Windows, MacOS, Ubuntu, IOS, and Android) that ensures the copyrighting of their content. 

Installation 

Step 1:

Install the package using Composer:

composer require sajed-zarinpour/spotplayer

Step 2:

Publish the config file of the package using the following command

php artisan vendor:publish --provider="SajedZarinpour\SpotPlayer\Providers\SpotPlayerServiceProvider"

Step 3:

Set values in the

config/spotplayer.php

Usage

The package provides both Facade and helper functions. Suppose you want to call a function some_func. Following calls are equivalent:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use SajedZarinpour\Spotplayer\Facades\SpotPlayer;

class SpotPlayerController extends Controller
{
    
    public function play(Request $request)
    {
       ...
       SpotPlayer::some_func();
       ...
    }
}

and

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;


class SpotPlayerController extends Controller
{
    
    public function play(Request $request)
    {
         ...
         spotplayer()->some_func();
         ...
    }
}

Note the import when using the Facade.

Basic Usage

Environement variables

SPOTPLAYER_API=YOURAPIKEY
SPOTPLAYER_MODE=test # OR production
SPOTPLAYER_DOMAIN=localhost # YOUR DOMAIN

Generating a licence

// Setting up a device
$device = spotplayer()->setDevice(
    $numberOfAllowedActiveDevices=2, 
    $Windows=0, 
    $MacOS=0, 
    $Ubuntu=0, 
    $Android=0, 
    $IOS=0, 
    $WebApp=2
);

// Generating a license
$licence = spotplayer()->licence(
    $name='John Doe', 
    $courses=['courseId1','courseId2'], 
    $watermarks='watermark text', 
    $device, 
    $payload='payload'
);

dump('licence id is:' . $licence['_id']);
dump('licence key is:' . $licence['key']);
dump('licence URL is:' . $licence['url']);

die;

Note

To generate cookie X, if you are serving on a localhost machine, make sure you run your Laravel program using:

php artisan serve --host=localhost

Otherwise the cookie won't set. Moreover, make sure Laravel won't encrypt the cookie X by adding

protected $except = ['X'];

to the $except array in Midllware/EncryptCookies.

Testing

The package is using pest for testing. Make sure that you are setting the Pest.php correctly

uses(
    Tests\TestCase::class,
)->in('Feature', '../vendor/sajed-zarinpour/spotplayer/tests');

Moreover, open vendor/sajed-zarinpour/spotplayer/tests/Unit/CourseTest.php and edit the file to use one of your course data.

dataset('provide_getCourseDetail_data', function () {
    return [
        [
            'put your spotplayer course id here!',
        ]
    ];
});

Run the following to run the test

./vendor/bin/pest vendor/sajed-zarinpour/spotplayer/tests/

Example

You can refer to laravel minimal example for a minimal example.

Docs

You can refer to documentation for further information.

sajed-zarinpour/spotplayer 适用场景与选型建议

sajed-zarinpour/spotplayer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 66 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「library」 「spotplayer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sajed-zarinpour/spotplayer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sajed-zarinpour/spotplayer 我们能提供哪些服务?
定制开发 / 二次开发

基于 sajed-zarinpour/spotplayer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 66
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 32
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-09