frontyard / cordova-plugin-exoplayer

Media player plugin for Cordova that uses Google's ExoPlayer
MIT License
54 stars 69 forks source link

set custom icons for controller #76

Closed jaber9030 closed 1 year ago

jaber9030 commented 5 years ago

I tried this code , controlIcons: { 'exo_rew': 'assets/icon/rew.png', 'exo_play': 'assets/icon/play.png', 'exo_pause': 'assets/icon/pause.png', 'exo_ffwd': 'assets/icon/ffwd.png', },

no icons were shown. also when i set controlIcons: { }, app is crashed

mkalyon commented 5 years ago

Hi What is the all of parameters code that use in your app?


controlIcons: { 'exo_rew': 'assets/icon/rew.png', 'exo_play': 'assets/icon/play.png', 'exo_pause': 'assets/icon/pause.png', 'exo_ffwd': 'assets/icon/ffwd.png', <------ I think, this comma must not be here },


Example code var parameters={ url: url, aspectRatio: 'FIT_SCREEN', hideTimeout: 5000, forwardTime: 60 1000, rewindTime: 60 1000, showBuffering: false, controller: { streamImage: logo, streamTitle: title, controlIcons: {

                },
                textColor: '#ffffffff', 
                buttonsColor: '#ffffffff', /
                bufferingColor: '#ff0000ff',
                hideProgress: false, 
                hidePosition: false, 
                hideDuration: false 
            }
        };  

window.ExoPlayer.show(parameters, successCallback, errorCallback);

jaber9030 commented 5 years ago

this is the whole code
import { Component, OnInit } from '@angular/core'; import { AndroidExoplayer } from '@ionic-native/android-exoplayer/ngx'; @Component({ selector: 'app-video', templateUrl: './video.page.html', styleUrls: ['./video.page.scss'], providers: [AndroidExoplayer] }) export class VideoPage implements OnInit { url: string; options: any; constructor(private androidExoPlayer: AndroidExoplayer) { this.url = 'https://bitmovin.com/player-content/playhouse-vr/m3u8s/105560.m3u8'; this.options = {url : this.url , controller: { // If this object is not present controller will not be visible streamImage: 'http://url.to/channel.png', streamTitle: 'Test Chanel/ Video 1', hideProgress: false, // Hide entire progress timebar hidePosition: false, // If timebar is visible hide current position from it hideDuration: false, // If timebar is visible Hide stream duration from it controlIcons: { 'exo_rew': '../assets/icon/rew.png', 'exo_play': '../assets/icon/play.png', 'exo_pause': '../assets/icon/pause.png', 'exo_ffwd': '../assets/icon/ffwd.png', }, textColor: '#dff0fe', // These colors can be any valid Android color // buttonsColor: '#dff0fe', // This example uses hex values including alpha (first byte) bufferingColor: '#dff0fe', // Alpha of 'ff' makes it 100% opaque,

}}; this.androidExoPlayer.show(this.options).subscribe(res => { this.androidExoPlayer.showController(); if (res.eventType === 'KEY_EVENT') { this.androidExoPlayer.close(); } }); } ngOnInit() { }

}

frontyard commented 5 years ago

Location of images must be proper URIs. So try putting file: in front, for example: 'exo_rew': 'file://../assets/icon/rew.png' I'm still not sure this exact string will work, but this is the root of your problem. Play with location until you get it working and watch 'adb logcat' if it's not.